// { dg-do compile } // { dg-options "-Os -fPIC" } extern char *bar (const char *, const char *); extern char *baz (char *, const char *); extern unsigned int fn (const char *); static const struct C { int i; } k = { 0}; struct S { S (const C &x, unsigned int *y) : a (x), b (y) {} const C &a; unsigned int *b; }; struct A { ~A (); void helper (const S &); }; struct B : private A { B (const S &x) { helper (x); } }; char * foo (char *x, const char *y) { unsigned int a; B b (S (k, &a)); char *c = x; if (bar (y, "foo")) { baz (c, "foo"); c += fn ("foo"); } else if (bar (y, "bar")) { baz (c, "bar"); c += fn ("bar"); } return x; } causes ICE on powerpc-linux (32-bit).
Confirmed.
Patch posted here: <http://gcc.gnu.org/ml/gcc-patches/2005-05/msg00972.html>.
Subject: Bug 21492 CVSROOT: /cvs/gcc Module name: gcc Changes by: jakub@gcc.gnu.org 2005-05-17 06:48:19 Modified files: gcc : ChangeLog cfgcleanup.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/opt: crossjump1.C Log message: PR middle-end/21492 * cfgcleanup.c (try_crossjump_to_edge): update_forwarder_flag for src2 if src2 has been split. * g++.dg/opt/crossjump1.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8812&r2=2.8813 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgcleanup.c.diff?cvsroot=gcc&r1=1.144&r2=1.145 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5480&r2=1.5481 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/crossjump1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 21492 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: jakub@gcc.gnu.org 2005-05-25 21:15:56 Modified files: gcc : ChangeLog cfgcleanup.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/opt: crossjump1.C Log message: PR middle-end/21492 * cfgcleanup.c (try_crossjump_to_edge): update_forwarder_flag for src2 if src2 has been split. * g++.dg/opt/crossjump1.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.261&r2=2.7592.2.262 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgcleanup.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.141&r2=1.141.2.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.197&r2=1.5084.2.198 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/crossjump1.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.4.1
Fixed.