diff options
author | Richard Biener <rguenther@suse.de> | 2014-08-26 08:03:32 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-08-26 08:03:32 +0000 |
commit | 8b2282660d24cce8198352f39ab1566af332716e (patch) | |
tree | 2b0ab2f8afd3c42dedec59e572f19c4142dbf52c /gcc | |
parent | 94d64bbd614a380a111db37f8c33fd6d4d6495e2 (diff) | |
download | gcc-8b2282660d24cce8198352f39ab1566af332716e.zip gcc-8b2282660d24cce8198352f39ab1566af332716e.tar.gz gcc-8b2282660d24cce8198352f39ab1566af332716e.tar.bz2 |
re PR c++/62175 (Internal compiler error in gimplify_modify_expr gimplify.c:4616)
2014-08-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/62175
* tree-ssa-loop-niter.c (expand_simple_operations): Do not
expand possibly trapping operations.
* g++.dg/torture/pr62175.C: New testcase.
From-SVN: r214492
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr62175.C | 36 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-niter.c | 3 |
4 files changed, 50 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e1a1bea..fbfeccb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-08-26 Richard Biener <rguenther@suse.de> + + PR tree-optimization/62175 + * tree-ssa-loop-niter.c (expand_simple_operations): Do not + expand possibly trapping operations. + 2014-08-26 David Malcolm <dmalcolm@redhat.com> * config/rs6000/rs6000.c (class swap_web_entry): Strengthen field diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eaacb50..a71d281 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-08-26 Richard Biener <rguenther@suse.de> + + PR tree-optimization/62175 + * g++.dg/torture/pr62175.C: New testcase. + 2014-08-25 Bernd Schmidt <bernds@codesourcery.com> * gcc.c-torture/execute/execute.exp: Replace with slightly adapted diff --git a/gcc/testsuite/g++.dg/torture/pr62175.C b/gcc/testsuite/g++.dg/torture/pr62175.C new file mode 100644 index 0000000..bcdea61 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr62175.C @@ -0,0 +1,36 @@ +// { dg-do compile } +// { dg-additional-options "-ftrapv" } + +struct B { + B(int = 0); +}; +int c; +int *d; +struct G { + G(); + int numProcs_; +}; +int fn1(); +B fn2() { + if (c) + return 0; + return B(); +} + +long &fn3(long &p1, long &p2) { + if (p2 < p1) + return p2; + return p1; +} + +void fn4(long p1) { + long a = fn1(); + fn2(); + int b = fn3(p1, a); + for (int i; i < b; ++i) + d[0] = 0; + for (; a < p1; ++a) + d[a] = 0; +} + +G::G() { fn4(numProcs_ + 1); } diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index d4d3e53..4da1855 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -1633,6 +1633,9 @@ expand_simple_operations (tree expr) case PLUS_EXPR: case MINUS_EXPR: + if (TYPE_OVERFLOW_TRAPS (TREE_TYPE (expr))) + return expr; + /* Fallthru. */ case POINTER_PLUS_EXPR: /* And increments and decrements by a constant are simple. */ e1 = gimple_assign_rhs2 (stmt); |