aboutsummaryrefslogtreecommitdiff
path: root/gcc/sanopt.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2017-07-28 12:36:36 +0200
committerMartin Liska <marxin@gcc.gnu.org>2017-07-28 10:36:36 +0000
commit70affe6aff39d347a0e2b7f12a27e1cad4cae405 (patch)
treee6761da9c83736d3fbff2f93dbf1f34a663bd39a /gcc/sanopt.c
parent16bab95a79485ac5139992bd5f190ad95602ddda (diff)
downloadgcc-70affe6aff39d347a0e2b7f12a27e1cad4cae405.zip
gcc-70affe6aff39d347a0e2b7f12a27e1cad4cae405.tar.gz
gcc-70affe6aff39d347a0e2b7f12a27e1cad4cae405.tar.bz2
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
Diffstat (limited to 'gcc/sanopt.c')
-rw-r--r--gcc/sanopt.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/sanopt.c b/gcc/sanopt.c
index b7740741..f6a3d6e 100644
--- a/gcc/sanopt.c
+++ b/gcc/sanopt.c
@@ -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. */