Do not instrument static target_expr for use-after-scope (PR sanitizer/90570).

2019-05-23  Martin Liska  <mliska@suse.cz>

	PR sanitizer/90570
	* gimplify.c (gimplify_target_expr): Skip TREE_STATIC target
	expression similarly to gimplify_decl_expr.
2019-05-23  Martin Liska  <mliska@suse.cz>

	PR sanitizer/90570
	* g++.dg/asan/pr90570.C: New test.

From-SVN: r271548
This commit is contained in:
Martin Liska 2019-05-23 12:12:01 +02:00 committed by Martin Liska
parent 02b7331304
commit 832ece86e5
4 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2019-05-23 Martin Liska <mliska@suse.cz>
PR sanitizer/90570
* gimplify.c (gimplify_target_expr): Skip TREE_STATIC target
expression similarly to gimplify_decl_expr.
2019-05-23 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* cse.c (cse_dump_path): s/dump_file/f.

View File

@ -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)
{

View File

@ -1,3 +1,8 @@
2019-05-23 Martin Liska <mliska@suse.cz>
PR sanitizer/90570
* g++.dg/asan/pr90570.C: New test.
2019-05-23 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/opt78.ad[sb]: New test.

View File

@ -0,0 +1,18 @@
/* PR sanitizer/90570 */
/* { dg-do run } */
#include <vector>
struct stru
{
std::vector<int> v{1,2,3,4};
int i{5};
};
int main()
{
stru s1;
stru s2;
return 0;
}