* 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
+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
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);
+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.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=bounds" } */
+
+struct T { int c; char d[]; } t = { 1, "abcdefg" };
+
+int
+baz (int i)
+{
+ return t.d[i];
+}