Bug 43805 - ICE when building Linux kernel 2.6.34-rc4
Summary: ICE when building Linux kernel 2.6.34-rc4
Status: RESOLVED DUPLICATE of bug 43726
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-19 20:26 UTC by Philip Pemberton
Modified: 2011-02-01 19:05 UTC (History)
2 users (show)

See Also:
Host:
Target: lm32-elf
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-04-19 21:39:30


Attachments
timerfd intermediate file (97.54 KB, application/octet-stream)
2010-04-19 20:27 UTC, Philip Pemberton
Details
Possible fix for bug (267 bytes, patch)
2010-05-26 09:15 UTC, Jon Beniston
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Pemberton 2010-04-19 20:26:34 UTC
Host: x86_64, Ubuntu Linux 9.10
Target: lm32-elf
GCC 4.5.0
../configure --prefix=/opt/lm32 --target=lm32-elf --enable-languages=c,c++ --with-newlib --enable-sjlj-exceptions


As reported on the Milkymist mailing list, gcc-4.5.0 is unable to build the Milkymist branch of the Linux kernel (http://github.com/tmatsuya/linux-2.6). This manifests itself as an Internal Compiler Error when compiling fs/timerfd.c:

make -f scripts/Makefile.build obj=fs/sysfs
  lm32-elf-gcc -Wp,-MD,fs/.timerfd.o.d  -nostdinc -isystem /opt/lm32/lib/gcc/lm32-elf/4.5.0/include -I/home/philpem/lm32/KERNELBUILD/linux-2.6/arch/lm32/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack   -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(timerfd)"  -D"KBUILD_MODNAME=KBUILD_STR(timerfd)"  -c -o fs/timerfd.o fs/timerfd.c
fs/timerfd.c: In function ‘timerfd_poll’:
fs/timerfd.c:105:1: error: unrecognizable insn:
(insn 44 43 45 5 fs/timerfd.c:94 (set (reg:SI 68)
        (subreg:SI (mem/s:DI (plus:SI (reg/v/f:SI 39 [ ctx ])
                    (const_int 64 [0x40])) [0 S8 A64]) 4)) -1 (nil))
fs/timerfd.c:105:1: internal compiler error: in extract_insn, at recog.c:2103
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[1]: *** [fs/timerfd.o] Error 1
make: *** [fs] Error 2


And from the command line with "-v -save-temps":

philpem@cheetah:~/lm32/KERNELBUILD/linux-2.6$ lm32-elf-gcc -v -save-temps -Wp,-MD,fs/.timerfd.o.d  -nostdinc -isystem /opt/lm32/lib/gcc/lm32-elf/4.5.0/include -I/home/philpem/lm32/KERNELBUILD/linux-2.6/arch/lm32/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack   -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(timerfd)"  -D"KBUILD_MODNAME=KBUILD_STR(timerfd)"  -save-temps -c -o fs/timerfd.o fs/timerfd.c
Using built-in specs.
COLLECT_GCC=lm32-elf-gcc
COLLECT_LTO_WRAPPER=/opt/lm32/libexec/gcc/lm32-elf/4.5.0/lto-wrapper
Target: lm32-elf
Configured with: ../configure --prefix=/opt/lm32 --target=lm32-elf --enable-languages=c,c++ --with-newlib --enable-sjlj-exceptions
Thread model: single
gcc version 4.5.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-nostdinc' '-isystem' '/opt/lm32/lib/gcc/lm32-elf/4.5.0/include' '-I/home/philpem/lm32/KERNELBUILD/linux-2.6/arch/lm32/include' '-Iinclude' '-include' 'include/generated/autoconf.h' '-D__KERNEL__' '-Wall' '-Wundef' '-Wstrict-prototypes' '-Wno-trigraphs' '-fno-strict-aliasing' '-fno-common' '-Werror-implicit-function-declaration' '-Wno-format-security' '-fno-delete-null-pointer-checks' '-O2' '-Wframe-larger-than=1024' '-fno-stack-protector' '-fomit-frame-pointer' '-g' '-Wdeclaration-after-statement' '-Wno-pointer-sign' '-fno-strict-overflow' '-fno-dwarf2-cfi-asm' '-fconserve-stack' '-DKBUILD_STR(s)=#s' '-DKBUILD_BASENAME=KBUILD_STR(timerfd)' '-DKBUILD_MODNAME=KBUILD_STR(timerfd)' '-save-temps' '-c' '-o' 'fs/timerfd.o'
 /opt/lm32/libexec/gcc/lm32-elf/4.5.0/cc1 -E -quiet -nostdinc -v -I/home/philpem/lm32/KERNELBUILD/linux-2.6/arch/lm32/include -Iinclude -D__KERNEL__ -DKBUILD_STR(s)=#s -DKBUILD_BASENAME=KBUILD_STR(timerfd) -DKBUILD_MODNAME=KBUILD_STR(timerfd) -isystem /opt/lm32/lib/gcc/lm32-elf/4.5.0/include -include include/generated/autoconf.h -MD fs/.timerfd.o.d fs/timerfd.c -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -Werror-implicit-function-declaration -Wno-format-security -Wframe-larger-than=1024 -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-aliasing -fno-common -fno-delete-null-pointer-checks -fno-stack-protector -fomit-frame-pointer -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -g -fworking-directory -O2 -fpch-preprocess -o timerfd.i
#include "..." search starts here:
#include <...> search starts here:
 /home/philpem/lm32/KERNELBUILD/linux-2.6/arch/lm32/include
 include
 /opt/lm32/lib/gcc/lm32-elf/4.5.0/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-nostdinc' '-isystem' '/opt/lm32/lib/gcc/lm32-elf/4.5.0/include' '-I/home/philpem/lm32/KERNELBUILD/linux-2.6/arch/lm32/include' '-Iinclude' '-include' 'include/generated/autoconf.h' '-D__KERNEL__' '-Wall' '-Wundef' '-Wstrict-prototypes' '-Wno-trigraphs' '-fno-strict-aliasing' '-fno-common' '-Werror-implicit-function-declaration' '-Wno-format-security' '-fno-delete-null-pointer-checks' '-O2' '-Wframe-larger-than=1024' '-fno-stack-protector' '-fomit-frame-pointer' '-g' '-Wdeclaration-after-statement' '-Wno-pointer-sign' '-fno-strict-overflow' '-fno-dwarf2-cfi-asm' '-fconserve-stack' '-DKBUILD_STR(s)=#s' '-DKBUILD_BASENAME=KBUILD_STR(timerfd)' '-DKBUILD_MODNAME=KBUILD_STR(timerfd)' '-save-temps' '-c' '-o' 'fs/timerfd.o'
 /opt/lm32/libexec/gcc/lm32-elf/4.5.0/cc1 -fpreprocessed timerfd.i -quiet -dumpbase timerfd.c -auxbase-strip fs/timerfd.o -g -O2 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -Werror-implicit-function-declaration -Wno-format-security -Wframe-larger-than=1024 -Wdeclaration-after-statement -Wno-pointer-sign -version -fno-strict-aliasing -fno-common -fno-delete-null-pointer-checks -fno-stack-protector -fomit-frame-pointer -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -o timerfd.s
GNU C (GCC) version 4.5.0 (lm32-elf)
	compiled by GNU C version 4.4.1, GMP version 4.3.1, MPFR version 2.4.1-p2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C (GCC) version 4.5.0 (lm32-elf)
	compiled by GNU C version 4.4.1, GMP version 4.3.1, MPFR version 2.4.1-p2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 82b2fc76371f663ecc11fc912a8ee928
fs/timerfd.c: In function ‘timerfd_poll’:
fs/timerfd.c:105:1: error: unrecognizable insn:
(insn 44 43 45 5 fs/timerfd.c:94 (set (reg:SI 68)
        (subreg:SI (mem/s:DI (plus:SI (reg/v/f:SI 39 [ ctx ])
                    (const_int 64 [0x40])) [0 S8 A64]) 4)) -1 (nil))
fs/timerfd.c:105:1: internal compiler error: in extract_insn, at recog.c:2103
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


This kernel compiles fine with gcc 3.4.0 and the lm32 patch which was published on the GCC mailing list.

Removing "-O2" from the command line allows gcc to pass the ICE and compile successfully.
Comment 1 Philip Pemberton 2010-04-19 20:27:40 UTC
Created attachment 20426 [details]
timerfd intermediate file

.i file, requested per bug reporting guidelines
Comment 2 Philip Pemberton 2010-04-19 20:33:22 UTC
Admittedly removing -O2 does fix the ICE in this file, however a different source file (mm/filemap.c) causes a gcc ICE when it isn't built with -O2:

mm/filemap.c: In function ‘do_generic_file_read’:
mm/filemap.c:1171:1: error: unrecognizable insn:
(insn 402 401 403 20 mm/filemap.c:1029 (set (reg:SI 389)
        (subreg:SI (mem/c/i:DI (plus:SI (reg/f:SI 33 virtual-stack-vars)
                    (const_int -52 [0xffffffffffffffcc])) [0 isize+0 S8 A64]) 4)) -1 (nil))
mm/filemap.c:1171:1: internal compiler error: in extract_insn, at recog.c:2103

So removing -O2 is *not* a viable workaround.
Comment 3 Steven Bosscher 2010-04-19 21:39:30 UTC
Removing -O2 is never a proper work-around anyway. This should just work.
Comment 4 Philip Pemberton 2010-04-22 21:28:24 UTC
I've just bisected the source tree with "svn-bisect" -- starting at rev 154096 (the first rev with lm32 support), ending at 158339 (gcc 4.5.0 release).

Turns out the bug was introduced in or before 154096, which doesn't really help a lot.... I know this code compiles with 4.4.0 thru 4.4.2 (patched), and it definitely DOESN'T work on 4.5.0.

Guess there's more work to be done.
Comment 5 Jon Beniston 2010-05-26 09:15:25 UTC
Created attachment 20746 [details]
Possible fix for bug
Comment 6 Sebastien Bourdeauducq 2011-02-01 19:05:57 UTC
Same as #43726

*** This bug has been marked as a duplicate of bug 43726 ***