Do not handle VLA in sanitization (PR sanitizer/81460).

2017-07-28  Martin Liska  <mliska@suse.cz>

	PR sanitizer/81460
	* sanopt.c (sanitize_rewrite_addressable_params): Do not rewrite
	parameters that are of a variable-length.
2017-07-28  Martin Liska  <mliska@suse.cz>

	PR sanitizer/81460
	* gcc.dg/asan/pr81460.c: New test.

From-SVN: r250655
This commit is contained in:
Martin Liska 2017-07-28 12:36:36 +02:00 committed by Martin Liska
parent 16bab95a79
commit 70affe6aff
4 changed files with 22 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2017-07-28 Martin Liska <mliska@suse.cz>
PR sanitizer/81460
* sanopt.c (sanitize_rewrite_addressable_params): Do not rewrite
parameters that are of a variable-length.
2017-07-28 Sebastian Huber <sebastian.huber@embedded-brains.de>
* config.gcc (powerpc-*-rtems*): Remove rs6000/eabi.h. Add

View file

@ -894,11 +894,12 @@ sanitize_rewrite_addressable_params (function *fun)
for (tree arg = DECL_ARGUMENTS (current_function_decl);
arg; arg = DECL_CHAIN (arg))
{
if (TREE_ADDRESSABLE (arg) && !TREE_ADDRESSABLE (TREE_TYPE (arg)))
tree type = TREE_TYPE (arg);
if (TREE_ADDRESSABLE (arg) && !TREE_ADDRESSABLE (type)
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
{
TREE_ADDRESSABLE (arg) = 0;
/* The parameter is no longer addressable. */
tree type = TREE_TYPE (arg);
has_any_addressable_param = true;
/* Create a new automatic variable. */

View file

@ -1,3 +1,8 @@
2017-07-28 Martin Liska <mliska@suse.cz>
PR sanitizer/81460
* gcc.dg/asan/pr81460.c: New test.
2017-07-28 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/81578

View file

@ -0,0 +1,8 @@
/* PR sanitizer/80460 */
/* { dg-do compile } */
int
f (int a, struct { int b[a]; } c) /* { dg-warning "anonymous struct declared inside parameter list will not be visible outside of this definition or declaration" } */
{
return c.b[0];
}