@@ -8434,8 +8434,7 @@ compute_array_index_type (tree name, tre
LE_EXPR rather than LT_EXPR. */
tree t = fold_build2 (PLUS_EXPR, TREE_TYPE (itype), itype,
build_one_cst (TREE_TYPE (itype)));
- t = fold_build2 (COMPOUND_EXPR, TREE_TYPE (t),
- ubsan_instrument_vla (input_location, t), t);
+ t = ubsan_instrument_vla (input_location, t);
finish_expr_stmt (t);
}
}
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable" } */
+
+void foo(int i)
+{
+ /* Don't warn here with "value computed is not used". */
+ char a[i];
+}
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-fsanitize=vla-bound -w -std=c++1y" } */
+/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable -std=c++1y" } */
/* { dg-shouldfail "ubsan" } */
int
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-fsanitize=vla-bound -w" } */
+/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable" } */
static int
bar (void)
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-fsanitize=vla-bound -w" } */
+/* { dg-options "-fsanitize=vla-bound" } */
/* Don't instrument the arrays here. */
int
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-fsanitize=vla-bound -w" } */
+/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable" } */
int
main (void)