diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2008-01-17 21:37:14 +0000 |
---|---|---|
committer | Andrew Macleod <amacleod@gcc.gnu.org> | 2008-01-17 21:37:14 +0000 |
commit | fae25b37f20b5015e494b7314b1d29136b88c5c7 (patch) | |
tree | e495590c621364970717dfc05ae84e3e64453da3 | |
parent | 2e152e16873f3774cbaf228cfdba670b18af51a0 (diff) | |
download | gcc-fae25b37f20b5015e494b7314b1d29136b88c5c7.zip gcc-fae25b37f20b5015e494b7314b1d29136b88c5c7.tar.gz gcc-fae25b37f20b5015e494b7314b1d29136b88c5c7.tar.bz2 |
Teach SCCVN that throwing expressions are not to be regenerated.
http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00764.html
Teach SCCVN that throwing expressions are not to be regenerated.
2008-01-17 Andrew MacLeod <amacleod@redhat.com>
* tree-ssa-sccvn.c (visit_use): Expressions which can throw are varying. * gcc.c-torture/compile/pr34648.c: New testcase.
From-SVN: r131610
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr34648.c | 39 | ||||
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 3 |
4 files changed, 51 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d00143a..9187463 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-01-17 Andrew MacLeod <amacleod@redhat.com> + + PR tree-optimization/34648 + * tree-ssa-sccvn.c (visit_use): Expressions which can throw are varying. + 2008-01-17 Anatoly Sokolov <aesok@post.ru> * config/avr/avr.h (LINK_SPEC): Support -mrelax and -mpmem-wrap-around. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3a46068..eb8a26c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-01-17 Andrew MacLeod <amacleod@redhat.com> + + PR tree-optimization/34648 + * gcc.c-torture/compile/pr34648.c: New testcase. + 2008-01-17 Sebastian Pop <sebastian.pop@amd.com> PR testsuite/34821 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34648.c b/gcc/testsuite/gcc.c-torture/compile/pr34648.c new file mode 100644 index 0000000..1f7472f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34648.c @@ -0,0 +1,39 @@ +/* PR tree-optimization/34648 */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fexceptions" } */ + +extern const unsigned short int **bar (void) __attribute__ ((const)); +const char *a; +int b; +char c; + +char +foo (int *x) +{ + char r; + + c = '\0'; + if (!b) + { + while (((*bar ())[a[*x]] & 0x2000) != 0) + (*x)++; + if (a[++(*x)] == '-') + { + (*x)++; + if (a[*x] && !((*bar ())[a[*x]] & 0x2000)) + return '?'; + } + if (!a[*x] || ((*bar ())[a[*x]] & 0x2000)) + { + while (((*bar ())[a[*x]] & 0x2000)) + ++(*x); + return '\0'; + } + } + + r = a[*x]; + b = a[*x] && !((*bar ())[a[*x]] & 0x2000); + return r; +} + diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 7f566db..d7b8c8a 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -1609,7 +1609,8 @@ visit_use (tree use) changed = visit_phi (stmt); } else if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT - || (ann && ann->has_volatile_ops)) + || (ann && ann->has_volatile_ops) + || tree_could_throw_p (stmt)) { changed = defs_to_varying (stmt); } |