extern int baz (int); int bar (void *); void foo (void *w, char *x, bool y, bool z) { char c = bar (w); int i = 0; while (1) { x[i++] = c; c = bar (w); if (y && c == '\'') break; if (z && c == '\"') break; if (!y && !z && !baz (c)) break; } x[i]=0; } causes ICE in compare_and_jump_seq on powerpc-linux, with both -O3 -m32 and -O3 -m64.
Created attachment 8792 [details] Patch I'm about to test.
Subject: Bug 21330 CVSROOT: /cvs/gcc Module name: gcc Changes by: jakub@gcc.gnu.org 2005-05-03 13:09:54 Modified files: gcc : ChangeLog loop-unswitch.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.c-torture/execute: 20050502-1.c Log message: PR rtl-optimization/21330 * loop-unswitch.c (may_unswitch_on): Set *cinsn only when returning non-NULL. (unswitch_single_loop): Clear cinsn when retrying. * gcc.c-torture/execute/20050502-1.c: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8573&r2=2.8574 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop-unswitch.c.diff?cvsroot=gcc&r1=1.29&r2=1.30 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5434&r2=1.5435 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20050502-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 21330 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: jakub@gcc.gnu.org 2005-05-06 10:52:39 Modified files: gcc : ChangeLog loop-unswitch.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.c-torture/execute: 20050502-1.c Log message: PR rtl-optimization/21330 * loop-unswitch.c (may_unswitch_on): Set *cinsn only when returning non-NULL. (unswitch_single_loop): Clear cinsn when retrying. * gcc.c-torture/execute/20050502-1.c: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.223&r2=2.7592.2.224 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop-unswitch.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.25&r2=1.25.12.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.163&r2=1.5084.2.164 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20050502-1.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
Fixed.