mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-25 18:05:44 +08:00
c-ubsan.c (ubsan_instrument_bounds): Don't instrument if TYPE_MAX_VALUE is NULL.
* c-ubsan.c (ubsan_instrument_bounds): Don't instrument if TYPE_MAX_VALUE is NULL. * gcc.dg/ubsan/bounds-1.c: New test. From-SVN: r212552
This commit is contained in:
parent
6ae5064251
commit
4d661eaacb
@ -1,3 +1,8 @@
|
||||
2014-07-15 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
* c-ubsan.c (ubsan_instrument_bounds): Don't instrument if
|
||||
TYPE_MAX_VALUE is NULL.
|
||||
|
||||
2014-07-14 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/61294
|
||||
|
@ -265,7 +265,7 @@ ubsan_instrument_bounds (location_t loc, tree array, tree *index,
|
||||
tree type = TREE_TYPE (array);
|
||||
tree domain = TYPE_DOMAIN (type);
|
||||
|
||||
if (domain == NULL_TREE)
|
||||
if (domain == NULL_TREE || TYPE_MAX_VALUE (domain) == NULL_TREE)
|
||||
return NULL_TREE;
|
||||
|
||||
tree bound = TYPE_MAX_VALUE (domain);
|
||||
|
@ -1,3 +1,7 @@
|
||||
2014-07-15 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
* gcc.dg/ubsan/bounds-1.c: New test.
|
||||
|
||||
2014-06-15 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
* gfortran.dg/coarray_34.f90: New.
|
||||
|
10
gcc/testsuite/gcc.dg/ubsan/bounds-1.c
Normal file
10
gcc/testsuite/gcc.dg/ubsan/bounds-1.c
Normal file
@ -0,0 +1,10 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-fsanitize=bounds" } */
|
||||
|
||||
struct T { int c; char d[]; } t = { 1, "abcdefg" };
|
||||
|
||||
int
|
||||
baz (int i)
|
||||
{
|
||||
return t.d[i];
|
||||
}
|
Loading…
Reference in New Issue
Block a user