Initialize live_switch_vars for SWITCH_BODY == STATEMENT_LIST (PR sanitizer/80879).
2017-06-19 Martin Liska <mliska@suse.cz> PR sanitizer/80879 * gimplify.c (gimplify_switch_expr): Initialize live_switch_vars for SWITCH_BODY == STATEMENT_LIST. 2017-06-19 Martin Liska <mliska@suse.cz> PR sanitizer/80879 * gcc.dg/asan/use-after-scope-switch-4.c: New test. From-SVN: r249368
This commit is contained in:
parent
1a1e0df1cd
commit
a6e5212a77
|
@ -1,3 +1,9 @@
|
|||
2017-06-19 Martin Liska <mliska@suse.cz>
|
||||
|
||||
PR sanitizer/80879
|
||||
* gimplify.c (gimplify_switch_expr):
|
||||
Initialize live_switch_vars for SWITCH_BODY == STATEMENT_LIST.
|
||||
|
||||
2017-06-19 Martin Liska <mliska@suse.cz>
|
||||
|
||||
* doc/install.texi: Document that PGO runs in 4 stages.
|
||||
|
|
|
@ -2279,7 +2279,8 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p)
|
|||
|
||||
/* Do not create live_switch_vars if SWITCH_BODY is not a BIND_EXPR. */
|
||||
saved_live_switch_vars = gimplify_ctxp->live_switch_vars;
|
||||
if (TREE_CODE (SWITCH_BODY (switch_expr)) == BIND_EXPR)
|
||||
tree_code body_type = TREE_CODE (SWITCH_BODY (switch_expr));
|
||||
if (body_type == BIND_EXPR || body_type == STATEMENT_LIST)
|
||||
gimplify_ctxp->live_switch_vars = new hash_set<tree> (4);
|
||||
else
|
||||
gimplify_ctxp->live_switch_vars = NULL;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2017-06-19 Martin Liska <mliska@suse.cz>
|
||||
|
||||
PR sanitizer/80879
|
||||
* gcc.dg/asan/use-after-scope-switch-4.c: New test.
|
||||
|
||||
2017-06-19 Martin Liska <mliska@suse.cz>
|
||||
|
||||
PR ipa/80732
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
// { dg-do run }
|
||||
// { dg-additional-options "-fdump-tree-gimple" }
|
||||
|
||||
int *ptr;
|
||||
|
||||
struct a
|
||||
{
|
||||
int c;
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct a e;
|
||||
e.c = 2;
|
||||
int x = 0;
|
||||
|
||||
for (;;)
|
||||
switch (e.c)
|
||||
case 3:
|
||||
{
|
||||
int resxxx;
|
||||
case 2:
|
||||
ptr = &resxxx;
|
||||
*ptr = 123;
|
||||
|
||||
if (x)
|
||||
return 0;
|
||||
else
|
||||
x = 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(UNPOISON, &resxxx, \[0-9\]\\);" 2 "gimple" } } */
|
Loading…
Reference in New Issue