PR sanitizer/79558
* ubsan.c (ubsan_type_descriptor): Check if TYPE_MAX_VALUE is null.
* c-c++-common/ubsan/bounds-14.c: New test.
From-SVN: r245605
PR middle-end/79537
* gimplify.c (gimplify_expr): Handle unused *&&L;.
+ PR sanitizer/79558
+ * ubsan.c (ubsan_type_descriptor): Check if TYPE_MAX_VALUE is null.
+
2017-02-20 Jakub Jelinek <jakub@redhat.com>
PR target/79568
PR middle-end/79537
* gcc.dg/comp-goto-4.c: New test.
+ PR sanitizer/79558
+ * c-c++-common/ubsan/bounds-14.c: New test.
+
2017-02-20 Jakub Jelinek <jakub@redhat.com>
PR target/79568
--- /dev/null
+/* PR sanitizer/79558 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=bounds" } */
+
+void
+fn1 (int n)
+{
+ int i, j;
+ int x[2][0];
+ for (i = 0; i < n; i++)
+ for (j = 0; j < n; j++)
+ x[i][j] = 5;
+}
{
pp_left_bracket (&pretty_name);
tree dom = TYPE_DOMAIN (t);
- if (dom && TREE_CODE (TYPE_MAX_VALUE (dom)) == INTEGER_CST)
+ if (dom != NULL_TREE
+ && TYPE_MAX_VALUE (dom) != NULL_TREE
+ && TREE_CODE (TYPE_MAX_VALUE (dom)) == INTEGER_CST)
{
if (tree_fits_uhwi_p (TYPE_MAX_VALUE (dom))
&& tree_to_uhwi (TYPE_MAX_VALUE (dom)) + 1 != 0)