Commit 4d661eaa by Marek Polacek Committed by Marek Polacek

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
parent 6ae50642
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> 2014-07-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/61294 PR middle-end/61294
......
...@@ -265,7 +265,7 @@ ubsan_instrument_bounds (location_t loc, tree array, tree *index, ...@@ -265,7 +265,7 @@ ubsan_instrument_bounds (location_t loc, tree array, tree *index,
tree type = TREE_TYPE (array); tree type = TREE_TYPE (array);
tree domain = TYPE_DOMAIN (type); tree domain = TYPE_DOMAIN (type);
if (domain == NULL_TREE) if (domain == NULL_TREE || TYPE_MAX_VALUE (domain) == NULL_TREE)
return NULL_TREE; return NULL_TREE;
tree bound = TYPE_MAX_VALUE (domain); tree bound = TYPE_MAX_VALUE (domain);
......
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> 2014-06-15 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/coarray_34.f90: New. * gfortran.dg/coarray_34.f90: New.
......
/* { dg-do compile } */
/* { dg-options "-fsanitize=bounds" } */
struct T { int c; char d[]; } t = { 1, "abcdefg" };
int
baz (int i)
{
return t.d[i];
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment