diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-01-11 18:59:22 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-01-11 18:59:22 +0100 |
commit | 9cb6bd7432547275c336b7dab5dd4db7a689eabb (patch) | |
tree | de11f3a495066ac7c43890adbd54100c2cd8cb77 /gcc | |
parent | 5a32af0ec5853edb0260d9e439ac646af5daed52 (diff) | |
download | gcc-9cb6bd7432547275c336b7dab5dd4db7a689eabb.zip gcc-9cb6bd7432547275c336b7dab5dd4db7a689eabb.tar.gz gcc-9cb6bd7432547275c336b7dab5dd4db7a689eabb.tar.bz2 |
re PR c++/69211 (g++ ICE on x86_64-linux-gnu (verify_gimple failed))
PR c++/69211
* cp-gimplify.c (cp_fold): If COMPOUND_EXPR or MODIFY_EXPR
folded operands have side-effects, but folding changed any of them,
build a new tree with the folded operands instead of returning the
unfolded tree.
* g++.dg/opt/pr69211.C: New test.
From-SVN: r232237
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/cp-gimplify.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/pr69211.C | 10 |
4 files changed, 26 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9aedf00..1f12121 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2016-01-11 Jakub Jelinek <jakub@redhat.com> + + PR c++/69211 + * cp-gimplify.c (cp_fold): If COMPOUND_EXPR or MODIFY_EXPR + folded operands have side-effects, but folding changed any of them, + build a new tree with the folded operands instead of returning the + unfolded tree. + 2016-01-09 Marek Polacek <polacek@redhat.com> PR c++/69113 diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 3bc2769..1478802 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -2086,7 +2086,11 @@ cp_fold (tree x) if ((code == COMPOUND_EXPR || code == MODIFY_EXPR) && ((op1 && TREE_SIDE_EFFECTS (op1)) || (op0 && TREE_SIDE_EFFECTS (op0)))) - break; + { + if (op0 != TREE_OPERAND (x, 0) || op1 != TREE_OPERAND (x, 1)) + x = build2_loc (loc, code, TREE_TYPE (x), op0, op1); + break; + } if (TREE_CODE (x) == COMPOUND_EXPR && !op0) op0 = build_empty_stmt (loc); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1497f00..9e9423b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-01-11 Jakub Jelinek <jakub@redhat.com> + PR c++/69211 + * g++.dg/opt/pr69211.C: New test. + PR tree-optimization/69214 * gcc.c-torture/compile/pr69214.c: New test. diff --git a/gcc/testsuite/g++.dg/opt/pr69211.C b/gcc/testsuite/g++.dg/opt/pr69211.C new file mode 100644 index 0000000..c3c5b1d --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr69211.C @@ -0,0 +1,10 @@ +// PR c++/69211 +// { dg-do compile } + +int a, b; + +int +foo () +{ + return (a & 5UL | (b = 4, 4L)) > 4; +} |