From: Richard Biener Date: Thu, 14 Mar 2019 11:07:41 +0000 (+0000) Subject: re PR tree-optimization/89710 (ICE in dyn_cast(gimple*) / should_dupl... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=df6d3ac9aa35d4d9cd23bc70e961490c19e2477d;p=gcc.git re PR tree-optimization/89710 (ICE in dyn_cast(gimple*) / should_duplicate_loop_header_p) 2019-03-14 Richard Biener PR tree-optimization/89710 * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Use safe_dyn_cast. * gcc.dg/torture/pr89710.c: New testcase. From-SVN: r269679 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 86a231956c0..329954b78ac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-14 Richard Biener + + PR tree-optimization/89710 + * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Use + safe_dyn_cast. + 2019-03-14 Martin Liska * coverage.c (coverage_begin_function): Stream also diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b0f9efa63fe..3536cf145e2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-14 Richard Biener + + PR tree-optimization/89710 + * gcc.dg/torture/pr89710.c: New testcase. + 2019-03-14 Richard Biener PR middle-end/89698 diff --git a/gcc/testsuite/gcc.dg/torture/pr89710.c b/gcc/testsuite/gcc.dg/torture/pr89710.c new file mode 100644 index 00000000000..01e875e1042 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr89710.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ + +void +gm (int *); + +__attribute__ ((returns_twice)) void +jg (void) +{ +} + +void +eb (void) +{ + int r6 = 0; + + if (r6 != 0) + gm (&r6); +} + +void +gm (int *r6) +{ + jg (); + + for (;;) + { + eb (); + *r6 = 0; + } +} diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c index f65e2b50567..25f562b0cec 100644 --- a/gcc/tree-ssa-loop-ch.c +++ b/gcc/tree-ssa-loop-ch.c @@ -100,7 +100,7 @@ should_duplicate_loop_header_p (basic_block header, struct loop *loop, return false; } - gcond *last = dyn_cast (last_stmt (header)); + gcond *last = safe_dyn_cast (last_stmt (header)); if (!last) { if (dump_file && (dump_flags & TDF_DETAILS))