From: Richard Biener Date: Mon, 4 Mar 2019 12:23:17 +0000 (+0000) Subject: re PR tree-optimization/89572 (ICE in dyn_cast(gimple*) / get_loop_ex... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=19d4e4d614655cf76d87522855103c01d029b2cf;p=gcc.git re PR tree-optimization/89572 (ICE in dyn_cast(gimple*) / get_loop_exit_condition(loop const*)) 2019-03-04 Richard Biener 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 024e018a25c..9fcb067526f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-04 Richard Biener + + PR middle-end/89572 + * tree-scalar-evolution.c: (get_loop_exit_condition): Use + safe_dyn_cast. + 2019-03-04 Bin Cheng PR tree-optimization/89487 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0b089b9ceab..1a5c8673be4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-04 Richard Biener + + PR middle-end/89572 + * gcc.dg/torture/pr89572.c: New testcase. + 2018-03-04 Bin Cheng 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 00000000000..1c293850c11 --- /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 16debb0b34d..3de559047da 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 (stmt)) + if (gcond *cond_stmt = safe_dyn_cast (stmt)) res = cond_stmt; }