Mainline is ICE'ing on testsuite/gcc.c-torture/compile/sync-1.c for some arguments to -march. For example: ./xgcc -B. -O2 /mnt/sysfs/rask/cvssrc/gcc/gcc/testsuite/gcc.c-torture/compile/sync-1.c -S -o /tmp/sync-1.s -march=pentium /mnt/sysfs/rask/cvssrc/gcc/gcc/testsuite/gcc.c-torture/compile/sync-1.c: In function 'test_lock': /mnt/sysfs/rask/cvssrc/gcc/gcc/testsuite/gcc.c-torture/compile/sync-1.c:261: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. It works with: i386, i486, winchip-c6, winchip2 and c3. It fails with: pentium, pentium-mmx, pentiumpro, pentium2, pentium3, pentium4, nocona, prescott, k6, k6-2, k6-3, k8, athlon, opteron and c3-2. The gcc-4.1.0-3 compiler shipped by Red Hat fails in the same way for the same arguments to -march.
Created attachment 11317 [details] Preprocessed source code
Note Redhat's 4.1.0 is closer to 4.2.0 than 4.1.0. Anyways confirmed a regression in that it worked in 4.1.0.
Also here is the backtrace: #0 split_di (operands=0xc0c768, num=0, lo_half=0x7fffff89ab58, hi_half=0x7fffff89ab48) at /home/pinskia/src/newtest/trunk/gcc/config/i386/i386.c:8037 #1 0x00000000007ff0eb in ix86_expand_branch (code=<value optimized out>, label=0x2aaaaae037d0) at /home/pinskia/src/newtest/trunk/gcc/config/i386/i386.c:10196 #2 0x00000000006c0ec6 in gen_bne (operand0=0x2aaaaae037d0) at i386.md:12951 #3 0x0000000000725a1b in expand_compare_and_swap_loop (mem=0x2aaaaafb3d20, old_reg=0x2aaaaafb3d40, new_reg=0x2aaaaafb3f60, seq=<value optimized out>) at /home/pinskia/src/newtest/trunk/gcc/optabs.c:5960 #4 0x000000000072bfdc in expand_sync_operation (mem=0x2aaaaafb3d20, val=<value optimized out>, code=AND) at /home/pinskia/src/newtest/trunk/gcc/optabs.c:6048 #5 0x0000000000533587 in expand_builtin (exp=0x2aaaaae03410, target=0xafafafafafafafaf, subtarget=0x0, mode=12633960, ignore=13) at /home/pinskia/src/newtest/trunk/gcc/builtins.c:6279 #6 0x00000000005c37ae in expand_expr_real_1 (exp=<value optimized out>, target=<value optimized out>, tmode=<value optimized out>, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /home/pinskia/src/newtest/trunk/gcc/expr.c:7584 This proves this is a target specific bug.
Janis could you do a regression hunt for this bug?
A regression hunt using an i686-linux cross compiler on powerpc-linux with the testcase attached in comment #1 identified this large merge from gomp-branch: http://gcc.gnu.org/viewcvs?view=rev&rev=108997 r108997 | rth | 2005-12-23 00:43:34 +0000 (Fri, 23 Dec 2005)
Reduced down to: signed long long sll; void foo (void) { __sync_fetch_and_add (&sll, 1); }
Posted a patch.
Subject: Re: [4.2 Regression] syncronization primitives cause ICE with -march=pentium or better On Sat, May 20, 2006 at 07:40:33PM -0000, kazu at gcc dot gnu dot org wrote: > Posted a patch. Patch ok. r~
Subject: Bug 27266 Author: kazu Date: Mon May 22 17:55:53 2006 New Revision: 113987 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113987 Log: gcc/ PR target/27266 * config/i386/i386.c (ix86_expand_branch): Jump to simple if ix86_compare_emitted is non-NULL. gcc/testsuite/ PR target/27266 * gcc.target/i386/pr27266.c: New. Added: trunk/gcc/testsuite/gcc.target/i386/pr27266.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c trunk/gcc/testsuite/ChangeLog
Checked in a patch.