Commit f8ef336f by Marek Polacek Committed by Marek Polacek

re PR sanitizer/59331 (ubsan gives extra warnings with vla.)

	PR sanitizer/59331
cp/
	* decl.c (compute_array_index_type): Don't build COMPOUND_EXPR for
	instrumentation.
testsuite/
	* g++.dg/ubsan/pr59331.C: New test.
	* g++.dg/ubsan/cxx1y-vla.C: Enable -Wall -Wno-unused-variable.
	Disable the -w option.
	* c-c++-common/ubsan/vla-1.c: Likewise.
	* c-c++-common/ubsan/vla-2.c: Likewise.
	* c-c++-common/ubsan/vla-3.c: Don't use the -w option.

From-SVN: r205544
parent 340baef7
2013-11-29 Marek Polacek <polacek@redhat.com>
PR sanitizer/59331
* decl.c (compute_array_index_type): Don't build COMPOUND_EXPR for
instrumentation.
2013-11-28 Jakub Jelinek <jakub@redhat.com>
PR c++/59297
......
......@@ -8434,8 +8434,7 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
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);
}
}
......
2013-11-29 Marek Polacek <polacek@redhat.com>
PR sanitizer/59331
* g++.dg/ubsan/pr59331.C: New test.
* g++.dg/ubsan/cxx1y-vla.C: Enable -Wall -Wno-unused-variable.
Disable the -w option.
* c-c++-common/ubsan/vla-1.c: Likewise.
* c-c++-common/ubsan/vla-2.c: Likewise.
* c-c++-common/ubsan/vla-3.c: Don't use the -w option.
2013-11-29 Joseph Myers <joseph@codesourcery.com>
PR c/42262
......
/* { dg-do run } */
/* { dg-options "-fsanitize=vla-bound -w" } */
/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable" } */
static int
bar (void)
......
/* { dg-do run } */
/* { dg-options "-fsanitize=vla-bound -w" } */
/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable" } */
int
main (void)
......
/* { dg-do run } */
/* { dg-options "-fsanitize=vla-bound -w" } */
/* { dg-options "-fsanitize=vla-bound" } */
/* Don't instrument the arrays here. */
int
......
/* { 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
......
/* { 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];
}
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