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
+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.
/* 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;
+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
--- /dev/null
+// { 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" } } */