diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 45294c25047..2ccb803d5c6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-05-23 Martin Liska + + PR sanitizer/90570 + * gimplify.c (gimplify_target_expr): Skip TREE_STATIC target + expression similarly to gimplify_decl_expr. + 2019-05-23 Prathamesh Kulkarni * cse.c (cse_dump_path): s/dump_file/f. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 6905165ad33..8337b36c411 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6668,6 +6668,7 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) } if (asan_poisoned_variables && DECL_ALIGN (temp) <= MAX_SUPPORTED_STACK_ALIGNMENT + && !TREE_STATIC (temp) && dbg_cnt (asan_use_after_scope) && !gimplify_omp_ctxp) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e422d71bdfe..b34d1cc74b4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-05-23 Martin Liska + + PR sanitizer/90570 + * g++.dg/asan/pr90570.C: New test. + 2019-05-23 Eric Botcazou * gnat.dg/opt78.ad[sb]: New test. diff --git a/gcc/testsuite/g++.dg/asan/pr90570.C b/gcc/testsuite/g++.dg/asan/pr90570.C new file mode 100644 index 00000000000..c2366905516 --- /dev/null +++ b/gcc/testsuite/g++.dg/asan/pr90570.C @@ -0,0 +1,18 @@ +/* PR sanitizer/90570 */ +/* { dg-do run } */ + +#include + +struct stru +{ + std::vector v{1,2,3,4}; + int i{5}; +}; + +int main() +{ + stru s1; + stru s2; + + return 0; +}