internal compiler error compiling kernel on powerpc

Bug #731665 reported by Andy Whitcroft
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Fix Released
Critical
Andrew Stubbs
Linaro GCC Tracking
In Progress
Undecided
Unassigned
gcc-4.5 (Ubuntu)
Fix Released
High
Unassigned
Natty
Fix Released
High
Unassigned

Bug Description

Binary package hint: gcc-4.5

We are getting internal compiler errors on powerpc (even with -fno-shrink-wrap) as below:

/build/buildd/linux-2.6.38/kernel/bounds.c: In function 'foo':
/build/buildd/linux-2.6.38/kernel/bounds.c:19:1: error: unrecognizable insn:
(insn 11 3 2 2 (UnKnown Unknown) -1 (nil))
/build/buildd/linux-2.6.38/kernel/bounds.c:19:1: internal compiler error: in extract_insn, at recog.c:2104
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.
make[5]: *** [kernel/bounds.s] Error 1
make[4]: *** [prepare0] Error 2
make[3]: *** [sub-make] Error 2
make[2]: *** [prepare] Error 2
make[1]: *** [sub-make] Error 2

Full details here: http://launchpadlibrarian.net/65894289/buildlog_ubuntu-natty-powerpc.linux_2.6.38-6.34_FAILEDTOBUILD.txt.gz

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: gcc-4.5 4.5.2-5ubuntu1
ProcVersionSignature: Ubuntu 2.6.38-6.33~pre1-generic 2.6.38-rc7
Uname: Linux 2.6.38-6-generic i686
NonfreeKernelModules: wl
Architecture: i386
Date: Tue Mar 8 23:09:30 2011
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release i386 (20100429)
ProcEnviron:
 LANGUAGE=en_GB:en
 PATH=(custom, user)
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: gcc-4.5
UpgradeStatus: Upgraded to natty on 2010-12-18 (80 days ago)

Related branches

Revision history for this message
Andy Whitcroft (apw) wrote :
Andy Whitcroft (apw)
tags: added: regression-release
Revision history for this message
Matthias Klose (doko) wrote :

please recheck with 4.5.2-5ubuntu2

Changed in gcc-4.5 (Ubuntu):
status: New → Incomplete
Revision history for this message
Andy Whitcroft (apw) wrote :

Ok this appears to be reproducible on 4.5.2-5ubuntu2 as well:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/powerpc-linux-gnu/4.5.2/lto-wrapper
Target: powerpc-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.2-5ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc --enable-secureplt --disable-softfloat --enable-targets=powerpc-linux,powerpc64-linux --with-cpu=default32 --disable-werror --with-long-double-128 --enable-checking=release --build=powerpc-linux-gnu --host=powerpc-linux-gnu --target=powerpc-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-5ubuntu2)

This is the raw compile command line:

gcc -m64 -nostdinc -isystem /usr/lib/gcc/powerpc-linux-gnu/4.5.2/include -I/usr/src/linux-headers-lbm- -I/home/apw/build/ubuntu-natty/ubuntu-natty/arch/powerpc/include -Iinclude -I/home/apw/build/ubuntu-natty/ubuntu-natty/include -include include/generated/autoconf.h -Iubuntu/include -I/home/apw/build/ubuntu-natty/ubuntu-natty/ubuntu/include -I/home/apw/build/ubuntu-natty/ubuntu-natty/. -I. -D__KERNEL__ -I/home/apw/build/ubuntu-natty/ubuntu-natty/arch/powerpc -Iarch/powerpc -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -fno-shrink-wrap -O2 -msoft-float -pipe -I/home/apw/build/ubuntu-natty/ubuntu-natty/arch/powerpc -Iarch/powerpc -mminimal-toc -mtraceback=none -mcall-aixdesc -mtune=power4 -mno-altivec -mno-spe -mspe=no -funit-at-a-time -fno-dwarf2-cfi-asm -mno-string -mno-sched-epilog -Wa,-maltivec -Wframe-larger-than=1024 -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -pg -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(bounds)" -D"KBUILD_MODNAME=KBUILD_STR(bounds)" -fverbose-asm -S -o kernel/bounds.s /home/apw/build/ubuntu-natty/ubuntu-natty/kernel/bounds.c

Changed in gcc-4.5 (Ubuntu):
status: Incomplete → Triaged
Revision history for this message
Andy Whitcroft (apw) wrote :

Doh, producing the errors as below:

/home/apw/build/ubuntu-natty/ubuntu-natty/kernel/bounds.c: In function 'foo':
/home/apw/build/ubuntu-natty/ubuntu-natty/kernel/bounds.c:19:1: error: unrecognizable insn:
(insn 12 4 2 2 (UnKnown Unknown) -1 (nil))
/home/apw/build/ubuntu-natty/ubuntu-natty/kernel/bounds.c:19:1: internal compiler error: in extract_insn, at recog.c:2104
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.

Revision history for this message
Matthias Klose (doko) wrote :

> Please submit a full bug report,
> with preprocessed source if appropriate.

please could you add this?

Revision history for this message
Matthias Klose (doko) wrote :

the log is from a powerpc build, but the bug is tagged i386. why?

Revision history for this message
Michael Hope (michaelh1) wrote :

Incomplete pending preprocessed source, sorry.

Changed in gcc-linaro:
status: New → Incomplete
Revision history for this message
Matthias Klose (doko) wrote :

fails with:
$ gcc -m64 -O2 -fno-strict-aliasing -fno-common -fno-delete-null-pointer-checks -msoft-float -mminimal-toc -mtraceback=none -mcall-aixdesc -mtune=power4 -mno-altivec -mno-string -mno-sched-epilog -Wa,-maltivec -S bounds.i

works, when removing -mno-sched-epilog

Revision history for this message
Matthias Klose (doko) wrote :

any reason why verbose builds are not enabled by default?

Changed in gcc-4.5 (Ubuntu):
importance: Undecided → High
milestone: none → ubuntu-11.04-beta-1
status: Triaged → Confirmed
Revision history for this message
Michael Hope (michaelh1) wrote :
Download full text (5.7 KiB)

I built a powerpc cross toolchain from gcc-linaro-4.5-2011.03-0. I can't reproduce the problem given the bounds.i and command line given by Matthias or Andy.

Attached is the assembly output.

Using built-in specs.
COLLECT_GCC=./bin/powerpc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/home/michaelh/opt/cross-gcc-linaro/libexec/gcc/powerpc-linux-gnu/4.5.3/lto-wrapper
Target: powerpc-linux-gnu
Configured with: ../../src/gcc-linaro-4.5-2011.03-0/configure --enable-languages=c --disable-libmudflap --disable-libssp --prefix=/home/michaelh/opt/cross-gcc-linaro --target=powerpc-linux-gnu --with-sysroot=/home/michaelh/opt/cross-gcc-linaro/powerpc-linux-gnu --with-build-sysroot=/media/8ae14326-df5a-4464-84b5-0b30fd9c2ff6/home/michaelh/linaro/cross-build/fancy-cross-gcc/build/sysroot/home/michaelh/opt/cross-gcc-linaro/powerpc-linux-gnu --disable-softfloat --enable-targets=powerpc-linux,powerpc64-linux --with-cpu=default32
Thread model: posix
gcc version 4.5.3 20110221 (prerelease) (Linaro GCC 4.5-2011.03-0)
COLLECT_GCC_OPTIONS='-v' '-m64' '-nostdinc' '-isystem' '/usr/lib/gcc/powerpc-linux-gnu/4.5.2/include' '-I/usr/src/linux-headers-lbm-' '-I/home/apw/build/ubuntu-natty/ubuntu-natty/arch/powerpc/include' '-Iinclude' '-I/home/apw/build/ubuntu-natty/ubuntu-natty/include' '-include' 'include/generated/autoconf.h' '-Iubuntu/include' '-I/home/apw/build/ubuntu-natty/ubuntu-natty/ubuntu/include' '-I/home/apw/build/ubuntu-natty/ubuntu-natty/.' '-I.' '-D__KERNEL__' '-I/home/apw/build/ubuntu-natty/ubuntu-natty/arch/powerpc' '-Iarch/powerpc' '-Wall' '-Wundef' '-Wstrict-prototypes' '-Wno-trigraphs' '-fno-strict-aliasing' '-fno-common' '-Werror-implicit-function-declaration' '-Wno-format-security' '-fno-delete-null-pointer-checks' '-fno-shrink-wrap' '-O2' '-msoft-float' '-pipe' '-I/home/apw/build/ubuntu-natty/ubuntu-natty/arch/powerpc' '-Iarch/powerpc' '-mminimal-toc' '-mtraceback=none' '-mcall-aixdesc' '-mtune=power4' '-mno-altivec' '-mno-spe' '-mspe=no' '-funit-at-a-time' '-fno-dwarf2-cfi-asm' '-mno-string' '-mno-sched-epilog' '-Wframe-larger-than=1024' '-fno-stack-protector' '-fno-omit-frame-pointer' '-fno-optimize-sibling-calls' '-pg' '-Wdeclaration-after-statement' '-Wno-pointer-sign' '-fno-strict-overflow' '-fconserve-stack' '-DCC_HAVE_ASM_GOTO' '-DKBUILD_STR(s)=#s' '-DKBUILD_BASENAME=KBUILD_STR(bounds)' '-DKBUILD_MODNAME=KBUILD_STR(bounds)' '-fverbose-asm' '-S'
 /home/michaelh/opt/cross-gcc-linaro/libexec/gcc/powerpc-linux-gnu/4.5.3/cc1 -fpreprocessed bounds.i -mbig -quiet -dumpbase bounds.i -m64 -msoft-float -mminimal-toc -mtraceback=none -mcall-aixdesc -mtune=power4 -mno-altivec -mno-spe -mspe=no -mno-string -mno-sched-epilog -auxbase bounds -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 -p -fno-strict-aliasing -fno-common -fno-delete-null-pointer-checks -fno-shrink-wrap -funit-at-a-time -fno-dwarf2-cfi-asm -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-strict-overflow -fconserve-stack -fverbose-asm -o bounds.s
GNU C (Linaro GCC 4.5-2011.03-0) version 4.5.3 20110221 (prerelease) (powerpc-l...

Read more...

Revision history for this message
Kate Stewart (kate.stewart) wrote :

Michael, Matthias,
    Could this be a cross compiler vs. native effect? I've confirmed the problem that is being seen is now just limited to powerpc native compiles of the toolchain. And have removed the i386 tag.

Andy, if there is some reason that i386 tag is needed, can you explain a bit more?

tags: added: powerpc
removed: i386
Revision history for this message
Michael Hope (michaelh1) wrote :

I can't reproduce this with a cross version of Ubuntu gcc-4.5_4.5.2-5ubuntu2. Output of building with -v is attached.

Next step is to get access to a powerpc host (kakadu) and try a native compile.

Revision history for this message
Michael Hope (michaelh1) wrote :

(Ignore the version string)

Revision history for this message
Michael Hope (michaelh1) wrote :
Download full text (4.6 KiB)

I can reproduce this on a native gcc-linaro-4.5-2011.03-0 built on the powerpc host 'davis':

(natty)michaelh@davis:~/linaro/gcc/build/gcc$ ./xgcc -B $PWD -m64 -O2 -fno-strict-aliasing -fno-common -fno-delete-null-pointer-checks -msoft-float -mminimal-toc -mtraceback=none -mcall-aixdesc -mtune=power4 -mno-altivec -mno-string -mno-sched-epilog -Wa,-maltivec -S ~/bounds.i
/home/apw/build/ubuntu-natty/ubuntu-natty/kernel/bounds.c: In function 'foo':
/home/apw/build/ubuntu-natty/ubuntu-natty/kernel/bounds.c:19:1: internal compiler error: Segmentation fault

Running gdb on cc1 shows:

(natty)michaelh@davis:~/linaro/gcc/build/gcc$ gdb --args ./cc1 -fpreprocessed /home/michaelh/bounds.i -mbig -msecure-plt -quiet -dumpbase bounds.i -m64 -msoft-float -mminimal-toc -mtraceback=none -mcall-aixdesc -mtune=power4 -mno-altivec -mno-string -mno-sched-epilog -auxbase bounds -O2 -version -fno-strict-aliasing -fno-common -fno-delete-null-pointer-checks -o bounds.s

GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "powerpc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/michaelh/linaro/gcc/build/gcc/cc1...done.
Breakpoint 1 at 0x10203324: file ../../gcc-linaro-4.5-2011.03-0/gcc/diagnostic.c, line 763.
Breakpoint 2 at 0x10203130: file ../../gcc-linaro-4.5-2011.03-0/gcc/diagnostic.c, line 703.
Breakpoint 3 at 0x10c44b30
Breakpoint 4 at 0x10c44ef0

(gdb) r

Starting program: /home/michaelh/linaro/gcc/build/gcc/cc1 -fpreprocessed /home/michaelh/bounds.i -mbig -msecure-plt -quiet -dumpbase bounds.i -m64 -msoft-float -mminimal-toc -mtraceback=none -mcall-aixdesc -mtune=power4 -mno-altivec -mno-string -mno-sched-epilog -auxbase bounds -O2 -version -fno-strict-aliasing -fno-common -fno-delete-null-pointer-checks -o bounds.s
GNU C (Linaro GCC 4.5-2011.03-0) version 4.5.3 20110221 (prerelease) (powerpc-linux-gnu)
 compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C (Linaro GCC 4.5-2011.03-0) version 4.5.3 20110221 (prerelease) (powerpc-linux-gnu)
 compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 4925f8161c97812c1a112f99f2c6393c

Program received signal SIGSEGV, Segmentation fault.
0x1025cc5c in emit_insn (x=0x1) at ../../gcc-linaro-4.5-2011.03-0/gcc/emit-rtl.c:4863
4863 switch (GET_CODE (x))

(gdb) back

#0 0x1025cc5c in emit_insn (x=0x1) at ../../gcc-linaro-4.5-2011.03-0/gcc/emit-rtl.c:4863
#1 0x101bae6c in insert_insn_on_edge (pattern=0x1, e=0xf7f675a0) at ../../gcc-linaro-4.5-2011.03-0/gcc/cfgrtl.c:1469
#2 0x103241e8 in thread_prologue_and_epilogue_insns () at ../../gcc-linaro-4.5-2011.03-0/gcc/function.c:5354
#3 0x103...

Read more...

Revision history for this message
Michael Hope (michaelh1) wrote :

The problem is due to prologue_seq in thread_prologue_and_epilogue_insns() being uninitialised and defaulting to the value of '1'. This is an invalid rtx pointer which fails downstream in emit_insn().

On my cross compiler, prologue_seq happened to be a good value and hence inserts wrong code instead of failing.

The change was introduced in gcc-linaro/4.5,revno=99474 as part of the shrink-wrap optimisation. It should happen on other naked functions. Initialising prologue_seq to NULL_RTX should work around the problem.

Changed in gcc-linaro:
status: Incomplete → Triaged
importance: Undecided → Critical
milestone: none → 4.5-2011.04-0
Revision history for this message
Matthias Klose (doko) wrote :

the suggested patch fixes the ICE.

Revision history for this message
Matthias Klose (doko) wrote :

no regressions in the gcc testsuite

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcc-4.5 - 4.5.2-5ubuntu3

---------------
gcc-4.5 (4.5.2-5ubuntu3) natty; urgency=low

  * Apply proposed fix for LP: #731665 (Michael Hope).
 -- Matthias Klose <email address hidden> Fri, 11 Mar 2011 12:50:47 +0100

Changed in gcc-4.5 (Ubuntu Natty):
status: Confirmed → Fix Released
Revision history for this message
Matthias Klose (doko) wrote :

temporary fix uploaded

Changed in gcc-4.5 (Ubuntu Natty):
status: Fix Released → In Progress
tags: added: patch
Revision history for this message
Andrew Stubbs (ams-codesourcery) wrote :

I've tested and committed the suggested patch.

Related: lp:gcc-linaro/4.5,revno=99487

Changed in gcc-linaro:
assignee: nobody → Andrew Stubbs (ams-codesourcery)
status: Triaged → Fix Committed
Changed in gcc-linaro-tracking:
milestone: none → 4.7.0
Revision history for this message
Colin Watson (cjwatson) wrote :

Unmilestoning from ubuntu-11.04-beta-1; the temporary fix is good enough for beta.

Changed in gcc-4.5 (Ubuntu Natty):
milestone: ubuntu-11.04-beta-1 → none
Michael Hope (michaelh1)
tags: added: shrinkwrap
Revision history for this message
Andrew Stubbs (ams-codesourcery) wrote :

Bernd has now posted this upstream:

http://<email address hidden>/msg01345.html

Changed in gcc-linaro-tracking:
status: New → In Progress
Revision history for this message
Bryce Harrington (bryce) wrote :

[Unmarked attached patch as a solution, since it's now included in natty and is just a temporary fix.]

Michael Hope (michaelh1)
Changed in gcc-linaro:
status: Fix Committed → Fix Released
Revision history for this message
Matthias Klose (doko) wrote :

fixed for natty

Changed in gcc-4.5 (Ubuntu Natty):
status: In Progress → Fix Released
Revision history for this message
Jeffrey Walton (noloader) wrote :
tags: added: 46merge
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.