Skip to contentSkip to conversation

__builtin_trap() broken?

DISCUSSION Rob Radez 2 participants 3 messages Apr 30, 2004 – May 3, 2004

lore
Share & tools
lore

Rob Radez

author
#0 lore raw

Howdy folks,
Trying to compile fs/reiserfs/journal.c in 2.6.6-rc1 (UP, sparc32, gcc 3.3.3) ICE'd with an 'unrecognizable insn'. It looks like there's a bad interaction with __builtin_trap() again, for at least gcc 3.3.3 from debian/testing. gcc 2.95.4 from debian does not ICE. I've tried to pare down the code as much as possible to get a useful test case, and have attached said test case below. This is where I go "Oh, crap, gcc" and run away in horror screaming like a little baby. As a workaround, going back to defining bug_trap as __asm__ __volatile__ ("t 0x5\n\t" : :
) appears to work.

The ICE I get with my test program is:

rradez@notporn:~$ gcc -O2  -m32 -c  reiserfs-ice.c
reiserfs-ice.c: In function `write_one_transaction':
reiserfs-ice.c:15: error: unrecognizable insn:
(insn 61 19 62 1 0x501b2080 (set (reg:SI 112)
        (zero_extract:SI (reg:SI 110)
            (const_int 1 [0x1])
            (const_int 31 [0x1f]))) -1 (nil)
    (expr_list:REG_DEAD (reg:SI 110)
        (nil)))
reiserfs-ice.c:15: internal compiler error: in extract_insn, at
recog.c:2175
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

If I'm being stupid, let me know and I'll try to remedy that. The code below while funky was extracted from what appears to actually be going on.

Regards,
Rob

/* compile gcc -O2 -m32 -c -o reiserfs-ice.o reiserfs-ice.c */
/* Reading specs from /usr/lib/gcc-lib/sparc-linux/3.3.3/specs
* Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --with-cpu=v7 --enable-objc-gc sparc-linux
* Thread model: posix
* gcc version 3.3.3 (Debian 20040401) */

static inline int my_prepared(unsigned long *bh) {
	return bh && (1UL & *bh);
}

void write_one_transaction(unsigned long *bh)

{
    if (my_prepared(bh))
        __builtin_trap();
}
#1 lore raw
Quoted 7 lines · Rob Radez

Trying to compile fs/reiserfs/journal.c in 2.6.6-rc1 (UP, sparc32, gcc 3.3.3) ICE'd with an 'unrecognizable insn'. It looks like there's a bad interaction with __builtin_trap() again, for at least gcc 3.3.3 from

* Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --with-cpu=v7 --enable-objc-gc sparc-linux
* Thread model: posix
* gcc version 3.3.3 (Debian 20040401) */

I can't reproduce this. Bogus Debian patches? gcc build options? Your test case looks good; please try with stock gcc 3.3.3 built with those same options that Debian uses (ie --with-kitchen-sink). If it still fails then I guess we'll have to change this again.

This is my compiler, which works:

Reading specs from /crossdev/sparc-linux/lib/gcc-lib/sparc-linux/3.3.3/specs
Configured with: /crossdev/build/src/gcc/configure --prefix=/crossdev/sparc-linux --with-newlib --disable-shared --enable-languages=c --disable-threads --disable-multilib --target=sparc-linux --srcdir=/crossdev/build/src/gcc Thread model: single
gcc version 3.3.3

Signature · 1 line
Keith M Wesolowski
author
#2 lore raw
In reply to Rob Radez
Quoted 10 lines · Keith M Wesolowski
Quoted 3 lines · Rob Radez

Trying to compile fs/reiserfs/journal.c in 2.6.6-rc1 (UP, sparc32, gcc 3.3.3) ICE'd with an 'unrecognizable insn'. It looks like there's a bad interaction with __builtin_trap() again, for at least gcc 3.3.3 from

I can't reproduce this. Bogus Debian patches? gcc build options? Your test case looks good; please try with stock gcc 3.3.3 built with those same options that Debian uses (ie --with-kitchen-sink). If it still fails then I guess we'll have to change this again.

[snip some stuff]

In IRC, I heard reports from other people that fs/reiserfs/journal.c ICE'd for them too with gcc 3.3.3 from gentoo (config for kernel available on request privately) but alas, I don't have it who or the exact version of gcc logged (please feel free to chime in if it was you) so it's unclear whether I just messed up in minimizing the test cast. I'll spend some more time and see if I can pin it down.

Rob