the attached test case (which comes from GTK+) causes GCC to ICE due to the -O2 -fPIC flags: sh4-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.. -DG_LOG_DOMAIN=\"Gtk\" -DGTK_LIBDIR=\"/usr/lib\" -DGTK_DATADIR=\"/usr/share\" -DGTK_ DATA_PREFIX=\"/usr\" -DGTK_SYSCONFDIR=\"/etc\" -DGTK_VERSION=\"2.12.7\" -DGTK_BINARY_VERSION=\"2.10.0\" -DGTK_HOST=\"sh4-unknown-linux-gnu\" -DGTK_COMPILATION -DGTK_PRINT_BACKENDS=\"file,lpr\" "-DGTK_PRINT_PREVIEW_COMMAND=\"evince --unlink-tempfile --preview --print-settings %s % f\"" -I../gtk -I.. -I../gdk -I../gdk -I../gdk-pixbuf -I../gdk-pixbuf -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_FILE_SYS TEM_ENABLE_UNSUPPORTED -DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED -DG_DISABLE_CAST_CHECKS -pthread -D_REENTRANT -I/usr/include/glib-2.0 -I/usr/l ib/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 - I/usr/include/atk-1.0 -pipe -O2 -Wall -MT gtknotebook.lo -MD -MP -MF .deps/gtknotebook.Tpo -c gtknotebook.c -fPIC -DPIC -o .libs/gtknoteboo k.o gtknotebook.c: In function 'gtk_notebook_set_focus_child': gtknotebook.c:3927: warning: dereferencing type-punned pointer will break strict-aliasing rules gtknotebook.c:3930: warning: dereferencing type-punned pointer will break strict-aliasing rules gtknotebook.c: In function 'gtk_notebook_real_remove': gtknotebook.c:4378: warning: dereferencing type-punned pointer will break strict-aliasing rules gtknotebook.c: In function 'gtk_notebook_calculate_tabs_allocation': gtknotebook.c:5488: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://bugs.gentoo.org/> for instructions. Preprocessed source stored into /tmp/cc3v7chW.out file, please attach this to your bugreport. gcc-4.2.2 and gcc-4.2.3 fail while gcc-4.1.1 works. occurs both natively on sh and when cross-compiling from powerpc.
Created attachment 15172 [details] PR35225-reduced.i
Created attachment 15173 [details] PR35225-orig.i
It seems that sh.c:find_barrier doesn't handle a corner case which occurs with the testcase. Although the given testcases don't fail on 4.3, it'd be a hidden issue even on trunk. Now I'm testing the patch below. I'll apply it on trunk first and then 4.2/4.3 if it survives with usual tests after we are out of a current critical section for branching. diff -uprN ORIG/gcc-4_2-branch/gcc/config/sh/sh.c LOCAL/gcc-4_2-branch/gcc/config/sh/sh.c --- ORIG/gcc-4_2-branch/gcc/config/sh/sh.c 2008-01-18 22:11:17.000000000 +0900 +++ LOCAL/gcc-4_2-branch/gcc/config/sh/sh.c 2008-02-18 11:25:56.000000000 +0900 @@ -3530,6 +3530,7 @@ find_barrier (int num_mova, rtx mova, rt rtx barrier_before_mova = 0, found_barrier = 0, good_barrier = 0; int si_limit; int hi_limit; + rtx orig = from; /* For HImode: range is 510, add 4 because pc counts from address of second instruction after this one, subtract 2 for the jump instruction @@ -3753,7 +3754,8 @@ find_barrier (int num_mova, rtx mova, rt /* If we exceeded the range, then we must back up over the last instruction we looked at. Otherwise, we just need to undo the NEXT_INSN at the end of the loop. */ - if (count_hi > hi_limit || count_si > si_limit) + if (PREV_INSN (from) != orig + && (count_hi > hi_limit || count_si > si_limit)) from = PREV_INSN (PREV_INSN (from)); else from = PREV_INSN (from);
Subject: Bug 35225 Author: kkojima Date: Wed Feb 20 23:37:58 2008 New Revision: 132503 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132503 Log: PR target/35225 * config/sh/sh.c (find_barrier): Don't go past 'from' argument. Modified: trunk/gcc/ChangeLog trunk/gcc/config/sh/sh.c
Subject: Bug 35225 Author: kkojima Date: Sun Mar 9 23:31:26 2008 New Revision: 133065 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133065 Log: Backport from mainline: PR target/35225 * config/sh/sh.c (find_barrier): Don't go past 'from' argument. Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/config/sh/sh.c
Subject: Bug 35225 Author: kkojima Date: Sun Mar 9 23:39:51 2008 New Revision: 133066 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133066 Log: Backport from mainline: PR target/35225 * config/sh/sh.c (find_barrier): Don't go past 'from' argument. Modified: branches/gcc-4_2-branch/gcc/ChangeLog branches/gcc-4_2-branch/gcc/config/sh/sh.c
Fixed.