diff options
author | Richard Biener <rguenther@suse.de> | 2019-03-04 12:23:17 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-03-04 12:23:17 +0000 |
commit | 19d4e4d614655cf76d87522855103c01d029b2cf (patch) | |
tree | e2a2b32d29b3576883ae772253770465b7767c51 | |
parent | 0e31827300f1ce12857070c5f27a10ebcca4933e (diff) | |
download | gcc-19d4e4d614655cf76d87522855103c01d029b2cf.zip gcc-19d4e4d614655cf76d87522855103c01d029b2cf.tar.gz gcc-19d4e4d614655cf76d87522855103c01d029b2cf.tar.bz2 |
re PR tree-optimization/89572 (ICE in dyn_cast<gcond*, gimple>(gimple*) / get_loop_exit_condition(loop const*))
2019-03-04 Richard Biener <rguenther@suse.de>
PR middle-end/89572
* tree-scalar-evolution.c: (get_loop_exit_condition): Use
safe_dyn_cast.
* gcc.dg/torture/pr89572.c: New testcase.
From-SVN: r269363
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr89572.c | 28 | ||||
-rw-r--r-- | gcc/tree-scalar-evolution.c | 2 |
4 files changed, 40 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 024e018a..9fcb067 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-04 Richard Biener <rguenther@suse.de> + + PR middle-end/89572 + * tree-scalar-evolution.c: (get_loop_exit_condition): Use + safe_dyn_cast. + 2019-03-04 Bin Cheng <bin.cheng@linux.alibaba.com> PR tree-optimization/89487 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0b089b9..1a5c867 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-04 Richard Biener <rguenther@suse.de> + + PR middle-end/89572 + * gcc.dg/torture/pr89572.c: New testcase. + 2018-03-04 Bin Cheng <bin.cheng@linux.alibaba.com> PR tree-optimization/89487 diff --git a/gcc/testsuite/gcc.dg/torture/pr89572.c b/gcc/testsuite/gcc.dg/torture/pr89572.c new file mode 100644 index 0000000..1c29385 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr89572.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-finline-functions" } */ + +int vh, it, k1; + +void +vn (void) +{ + ++vh; + if (vh == 0 && it == 0) + k1 = -k1; +} + +__attribute__ ((returns_twice)) void +ef (int *uw) +{ + while (uw != (void *) 0) + { + vn (); + *uw = 0; + } +} + +void +gu (int *uw) +{ + ef (uw); +} diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 16debb0..3de5590 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -910,7 +910,7 @@ get_loop_exit_condition (const struct loop *loop) gimple *stmt; stmt = last_stmt (exit_edge->src); - if (gcond *cond_stmt = dyn_cast <gcond *> (stmt)) + if (gcond *cond_stmt = safe_dyn_cast <gcond *> (stmt)) res = cond_stmt; } |