From 32410d02e0b1e561e61fbfc7de76a24d805518e3 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 3 Feb 2012 12:55:29 +0100 Subject: [PATCH] re PR rtl-optimization/52092 (ICE: internal consistency failure) PR rtl-optimization/52092 * loop-unswitch.c (unswitch_single_loop): Call copy_rtx_if_shared on get_iv_value result. * gcc.c-torture/compile/pr52092.c: New test. Co-Authored-By: Zdenek Dvorak From-SVN: r183869 --- gcc/ChangeLog | 7 ++++++ gcc/loop-unswitch.c | 4 +-- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.c-torture/compile/pr52092.c | 25 +++++++++++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr52092.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cb11fed3feb..cbb76e43548 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2012-02-03 Jakub Jelinek + Zdenek Dvorak + + PR rtl-optimization/52092 + * loop-unswitch.c (unswitch_single_loop): Call copy_rtx_if_shared + on get_iv_value result. + 2012-02-02 Andrew Pinski PR middle-end/47982 diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c index 77524d8bfe3..78da1154299 100644 --- a/gcc/loop-unswitch.c +++ b/gcc/loop-unswitch.c @@ -1,5 +1,5 @@ /* Loop unswitching for GNU compiler. - Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 + Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2012 Free Software Foundation, Inc. This file is part of GCC. @@ -367,7 +367,7 @@ unswitch_single_loop (struct loop *loop, rtx cond_checked, int num) fprintf (dump_file, ";; Unswitching loop\n"); /* Unswitch the loop on this condition. */ - nloop = unswitch_loop (loop, bbs[i], cond, cinsn); + nloop = unswitch_loop (loop, bbs[i], copy_rtx_if_shared (cond), cinsn); gcc_assert (nloop); /* Invoke itself on modified loops. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e47725a0681..0c209962133 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-02-03 Jakub Jelinek + + PR rtl-optimization/52092 + * gcc.c-torture/compile/pr52092.c: New test. + 2012-02-02 Mikael Morin PR fortran/41587 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr52092.c b/gcc/testsuite/gcc.c-torture/compile/pr52092.c new file mode 100644 index 00000000000..4c39c7772a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr52092.c @@ -0,0 +1,25 @@ +/* PR rtl-optimization/52092 */ + +int a, b, c, d, e, f, g; + +void +foo (void) +{ + for (;;) + { + int *h = 0; + int i = 3; + int **j = &h; + if (e) + { + c = d || a; + g = c ? a : b; + if ((char) (i * g)) + { + h = &f; + *h = 0; + } + **j = 0; + } + } +}