From 5721768d285b6b474a2b73e42dcec156e52ef13d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 26 Nov 2014 15:16:24 +0000 Subject: [PATCH] re PR tree-optimization/63738 (ssa corruption when compiled with -O3) 2014-11-26 Richard Biener PR middle-end/63738 * tree-data-ref.c (split_constant_offset_1): Do not follow SSA edges for SSA names with SSA_NAME_OCCURS_IN_ABNORMAL_PHI. * gcc.dg/torture/pr63738.c: New testcase. From-SVN: r218088 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr63738.c | 27 ++++++++++++++++++++++++++ gcc/tree-data-ref.c | 3 +++ 4 files changed, 41 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr63738.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 34f66f95b2b..79c5411c324 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-11-26 Richard Biener + + PR middle-end/63738 + * tree-data-ref.c (split_constant_offset_1): Do not follow + SSA edges for SSA names with SSA_NAME_OCCURS_IN_ABNORMAL_PHI. + 2014-11-26 Richard Biener * fold-const.h (const_unop): Declare. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 19e7aa17c6a..5c0ecd7cddb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-11-26 Richard Biener + + PR middle-end/63738 + * gcc.dg/torture/pr63738.c: New testcase. + 2014-11-26 Ilya Enkovich PR bootstrap/63995 diff --git a/gcc/testsuite/gcc.dg/torture/pr63738.c b/gcc/testsuite/gcc.dg/torture/pr63738.c new file mode 100644 index 00000000000..de40a9c673d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr63738.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ + +#include + +struct longjmp_buffer { + jmp_buf buf; +}; + +void plouf(); + +extern long interprete() +{ + long * sp; + int i; + long *args; + int n; + + struct longjmp_buffer raise_buf; + _setjmp (raise_buf.buf); + + plouf(); + sp -= 4; + for (i = 0; i < n; i++) + args[i] = sp[10-i]; + plouf(); + return 0; +} diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 909751c8ff3..387da6cb40e 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -674,6 +674,9 @@ split_constant_offset_1 (tree type, tree op0, enum tree_code code, tree op1, case SSA_NAME: { + if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op0)) + return false; + gimple def_stmt = SSA_NAME_DEF_STMT (op0); enum tree_code subcode; -- 2.30.2