Bug 46059 - internel compiler error when compiling libjava/gnu/awt/LightweightRedirector.java with -finline-functions
Summary: internel compiler error when compiling libjava/gnu/awt/LightweightRedirector....
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2010-10-17 18:18 UTC by Witold Baryluk
Modified: 2010-10-21 23:06 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Witold Baryluk 2010-10-17 18:18:59 UTC
Hi.

I have long standing problem of bootstraping gcc 4.6 with -finline-functions (or -O3 actually).



# export FLAGS="-O2 -finline-functions"
# export CFLAGS=$FLAGS
# export CXXFLAGS=$FLAGS

# cd /
# rm -rf /scratch/obiekty
# mkdir /scratch/obiekty || exit 1
# cd /scratch/obiekty
# /scratch/gcc-4.6-20101016/configure \
	--enable-languages=c,c++,java \
	--enable-checking=yes \
	CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS"

# make "BOOT_CFLAGS=$CFLAGS" bootstrap


...
libtool: compile:  /scratch/obiekty/./gcc/gcj -B/scratch/obiekty/i686-pc-linux-gnu/libjava/ -B/scratch/obiekty/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -ffloat-store -fomit-frame-pointer -Usun -fclasspath= -fbootclasspath=/scratch/gcc-4.6-20101009/libjava/classpath/lib --encoding=UTF-8 -Wno-deprecated -fbootstrap-classes -g -O2 -c -fsource-filename=/scratch/obiekty/i686-pc-linux-gnu/libjava/classpath/lib/classes -MT gnu/awt.lo -MD -MP -MF gnu/awt.deps @gnu/awt.list  -fPIC -o gnu/.libs/awt.o
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java: In class 'gnu.awt.LightweightRedirector':
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java: In method 'gnu.awt.LightweightRedirector.getButtonNumber(java.awt.event.InputEvent)':
In file included from <built-in>:2:0:
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java:160:0: error: verification failed at PC=12: branch out of range
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java:160:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[3]: *** [gnu/awt.lo] Błąd 1
make[3]: Opuszczenie katalogu `/scratch/obiekty/i686-pc-linux-gnu/libjava'
make[2]: *** [all-recursive] Błąd 1
make[2]: Opuszczenie katalogu `/scratch/obiekty/i686-pc-linux-gnu/libjava'
make[1]: *** [all-target-libjava] Błąd 2
make[1]: Opuszczenie katalogu `/scratch/obiekty'
make: *** [bootstrap] Błąd 2
#



This problem is present in gcc 4.6 snapshots from more than a month. Compiling without -finline-functions resolves problem.




Compiling manually with '-v -save-temps':


root@tytus:/scratch/obiekty/i686-pc-linux-gnu/libjava# /scratch/obiekty/./gcc/gcj -v -save-temps  -B/scratch/obiekty/i686-pc-linux-gnu/libjava/ -B/scratch/obiekty/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -ffloat-store -fomit-frame-pointer -Usun -fclasspath= -fbootclasspath=/scratch/gcc-4.6-20101009/libjava/classpath/lib --encoding=UTF-8 -Wno-deprecated -fbootstrap-classes -g -O2 -c -fsource-filename=/scratch/obiekty/i686-pc-linux-gnu/libjava/classpath/lib/classes -MT gnu/awt.lo -MD -MP -MF gnu/awt.deps @gnu/awt.list  -fPIC -o gnu/.libs/awt.o
Reading specs from /scratch/obiekty/./gcc/specs
Reading specs from /scratch/obiekty/i686-pc-linux-gnu/libjava/libgcj.spec
rename spec startfile to startfileorig
rename spec lib to liborig
COLLECT_GCC=/scratch/obiekty/./gcc/gcj
COLLECT_LTO_WRAPPER=/scratch/obiekty/./gcc/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: /scratch/gcc-4.6-20101009/configure --enable-languages=c,c++,java --enable-checking=yes CFLAGS='-O2 -finline-functions' CXXFLAGS='-O2 -finline-functions'
Thread model: posix
gcc version 4.6.0 20101016 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-B' '/scratch/obiekty/i686-pc-linux-gnu/libjava/' '-B' '/scratch/obiekty/./gcc/' '-B' '/usr/local/i686-pc-linux-gnu/bin/' '-B' '/usr/local/i686-pc-linux-gnu/lib/' '-isystem' '/usr/local/i686-pc-linux-gnu/include' '-isystem' '/usr/local/i686-pc-linux-gnu/sys-include' '-ffloat-store' '-fomit-frame-pointer' '-U' 'sun' '-fencoding=UTF-8' '-Wno-deprecated' '-fbootstrap-classes' '-g' '-O2' '-c' '-fsource-filename=/scratch/obiekty/i686-pc-linux-gnu/libjava/classpath/lib/classes' '-MT' 'gnu/awt.lo' '-MD' '-MP' '-MF' 'gnu/awt.deps' '-fPIC' '-o' 'gnu/.libs/awt.o' '-fbootclasspath=./:/scratch/gcc-4.6-20101009/libjava/classpath/lib/' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro'
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-B' '/scratch/obiekty/i686-pc-linux-gnu/libjava/' '-B' '/scratch/obiekty/./gcc/' '-B' '/usr/local/i686-pc-linux-gnu/bin/' '-B' '/usr/local/i686-pc-linux-gnu/lib/' '-isystem' '/usr/local/i686-pc-linux-gnu/include' '-isystem' '/usr/local/i686-pc-linux-gnu/sys-include' '-ffloat-store' '-fomit-frame-pointer' '-U' 'sun' '-fencoding=UTF-8' '-Wno-deprecated' '-fbootstrap-classes' '-g' '-O2' '-c' '-fsource-filename=/scratch/obiekty/i686-pc-linux-gnu/libjava/classpath/lib/classes' '-MT' 'gnu/awt.lo' '-MD' '-MP' '-MF' 'gnu/awt.deps' '-fPIC' '-o' 'gnu/.libs/awt.o' '-fbootclasspath=./:/scratch/gcc-4.6-20101009/libjava/classpath/lib/' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro'
 /scratch/obiekty/./gcc/jc1 /scratch/gcc-4.6-20101009/libjava/classpath/lib/gnu/awt/LightweightRedirector.class -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc -fnon-call-exceptions -fkeep-inline-functions -quiet -dumpbase LightweightRedirector.class -mtune=generic -march=pentiumpro -auxbase-strip gnu/.libs/awt.o -g -O2 -Wno-deprecated -version -ffloat-store -fomit-frame-pointer -fencoding=UTF-8 -fbootstrap-classes -fsource-filename=/scratch/obiekty/i686-pc-linux-gnu/libjava/classpath/lib/classes -fPIC -fbootclasspath=./:/scratch/gcc-4.6-20101009/libjava/classpath/lib/ -faux-classpath LightweightRedirector.zip -MD_ -MT gnu/awt.lo -MF gnu/awt.deps -o LightweightRedirector.s
GNU Java (GCC) version 4.6.0 20101016 (experimental) (i686-pc-linux-gnu)
	compiled by GNU C version 4.6.0 20101016 (experimental), GMP version 4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Java (GCC) version 4.6.0 20101016 (experimental) (i686-pc-linux-gnu)
	compiled by GNU C version 4.6.0 20101016 (experimental), GMP version 4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Class path starts here:
    LightweightRedirector.zip/ (zip)
    ./ (system)
    /scratch/gcc-4.6-20101009/libjava/classpath/lib/ (system)
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java: In class 'gnu.awt.LightweightRedirector':
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java: In method 'gnu.awt.LightweightRedirector.getButtonNumber(java.awt.event.InputEvent)':
In file included from <built-in>:2:0:
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java:160:0: error: verification failed at PC=12: branch out of range
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java:160:0: internal compiler error: Naruszenie ochrony pamięci
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.



So, debuging in gdb last command:


root@tytus:/scratch/obiekty/i686-pc-linux-gnu/libjava# gdb --args /scratch/obiekty/./gcc/jc1 /scratch/gcc-4.6-20101009/libjava/classpath/lib/gnu/awt/LightweightRedirector.class -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc -fnon-call-exceptions -fkeep-inline-functions -quiet -dumpbase LightweightRedirector.class -mtune=generic -march=pentiumpro -auxbase-strip gnu/.libs/awt.o -g -O2 -Wno-deprecated -version -ffloat-store -fomit-frame-pointer -fencoding=UTF-8 -fbootstrap-classes -fsource-filename=/scratch/obiekty/i686-pc-linux-gnu/libjava/classpath/lib/classes -fPIC -fbootclasspath=./:/scratch/gcc-4.6-20101009/libjava/classpath/lib/ -faux-classpath LightweightRedirector.zip -MD_ -MT gnu/awt.lo -MF gnu/awt.deps -o LightweightRedirector.s
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 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 "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /scratch/obiekty/gcc/jc1...done.
(gdb) run
Starting program: /scratch/obiekty/gcc/jc1 /scratch/gcc-4.6-20101009/libjava/classpath/lib/gnu/awt/LightweightRedirector.class -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc -fnon-call-exceptions -fkeep-inline-functions -quiet -dumpbase LightweightRedirector.class -mtune=generic -march=pentiumpro -auxbase-strip gnu/.libs/awt.o -g -O2 -Wno-deprecated -version -ffloat-store -fomit-frame-pointer -fencoding=UTF-8 -fbootstrap-classes -fsource-filename=/scratch/obiekty/i686-pc-linux-gnu/libjava/classpath/lib/classes -fPIC -fbootclasspath=./:/scratch/gcc-4.6-20101009/libjava/classpath/lib/ -faux-classpath LightweightRedirector.zip -MD_ -MT gnu/awt.lo -MF gnu/awt.deps -o LightweightRedirector.s
GNU Java (GCC) version 4.6.0 20101016 (experimental) (i686-pc-linux-gnu)
	compiled by GNU C version 4.6.0 20101016 (experimental), GMP version 4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Java (GCC) version 4.6.0 20101016 (experimental) (i686-pc-linux-gnu)
	compiled by GNU C version 4.6.0 20101016 (experimental), GMP version 4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Class path starts here:
    LightweightRedirector.zip/ (zip)
    ./ (system)
    /scratch/gcc-4.6-20101009/libjava/classpath/lib/ (system)
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java: In class 'gnu.awt.LightweightRedirector':
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java: In method 'gnu.awt.LightweightRedirector.getButtonNumber(java.awt.event.InputEvent)':
In file included from <built-in>:2:0:
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java:160:0: error: verification failed at PC=12: branch out of range

Program received signal SIGSEGV, Segmentation fault.
0x080eba22 in merge_into ()
(gdb) bt
#0  0x080eba22 in merge_into ()
#1  0x080ee586 in verify_instructions_0 ()
#2  0x080f38f5 in verify_method ()
#3  0x080eaf4a in verify_jvm_instructions_new ()
#4  0x080e04f9 in expand_byte_code ()
#5  0x080faa5c in parse_class_file ()
#6  0x080fb325 in java_parse_file ()
#7  0x0841a076 in toplev_main ()
#8  0x08106deb in main ()
(gdb) 


Will see if compiling with additional -g, will show me something more.
Comment 1 Witold Baryluk 2010-10-17 19:42:33 UTC
Same version compiled with '-g -O2 -finline-functions', to have debuging symbols.

(gdb) run
Starting program: /scratch/obiekty/gcc/jc1 /scratch/gcc-4.6-20101009/libjava/classpath/lib/gnu/awt/LightweightRedirector.class -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc -fnon-call-exceptions -fkeep-inline-functions -quiet -dumpbase LightweightRedirector.class -mtune=generic -march=pentiumpro -auxbase-strip gnu/.libs/awt.o -g -O2 -Wno-deprecated -version -ffloat-store -fomit-frame-pointer -fencoding=UTF-8 -fbootstrap-classes -fsource-filename=/scratch/obiekty/i686-pc-linux-gnu/libjava/classpath/lib/classes -fPIC -fbootclasspath=./:/scratch/gcc-4.6-20101009/libjava/classpath/lib/ -faux-classpath LightweightRedirector.zip -MD_ -MT gnu/awt.lo -MF gnu/awt.deps -o LightweightRedirector.s
GNU Java (GCC) version 4.6.0 20101016 (experimental) (i686-pc-linux-gnu)
	compiled by GNU C version 4.6.0 20101016 (experimental), GMP version 4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Java (GCC) version 4.6.0 20101016 (experimental) (i686-pc-linux-gnu)
	compiled by GNU C version 4.6.0 20101016 (experimental), GMP version 4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Class path starts here:
    LightweightRedirector.zip/ (zip)
    ./ (system)
    /scratch/gcc-4.6-20101009/libjava/classpath/lib/ (system)
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java: In class 'gnu.awt.LightweightRedirector':
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java: In method 'gnu.awt.LightweightRedirector.getButtonNumber(java.awt.event.InputEvent)':
In file included from <built-in>:2:0:
/scratch/gcc-4.6-20101009/libjava/gnu/awt/LightweightRedirector.java:160:0: error: verification failed at PC=12: branch out of range

Program received signal SIGSEGV, Segmentation fault.
0x080eba22 in merge_into (npc=111936440, from_state=0x8d2e9b8) at /scratch/gcc-4.6-20101009/gcc/java/verify-impl.c:1415
1415	  for (iter = vfr->states[npc]; iter != NULL; iter = iter->next)
(gdb) bt
#0  0x080eba22 in merge_into (npc=111936440, from_state=0x8d2e9b8) at /scratch/gcc-4.6-20101009/gcc/java/verify-impl.c:1415
#1  0x080ee586 in push_jump () at /scratch/gcc-4.6-20101009/gcc/java/verify-impl.c:1460
#2  verify_instructions_0 () at /scratch/gcc-4.6-20101009/gcc/java/verify-impl.c:2867
#3  0x080f38f5 in verify_instructions (meth=0xbffff218) at /scratch/gcc-4.6-20101009/gcc/java/verify-impl.c:3197
#4  verify_method (meth=0xbffff218) at /scratch/gcc-4.6-20101009/gcc/java/verify-impl.c:3306
#5  0x080eaf4a in verify_jvm_instructions_new (jcf=0xb75ec000, byte_ops=0x8cfcbdf "+\266", length=74) at /scratch/gcc-4.6-20101009/gcc/java/verify-glue.c:498
#6  0x080e04f9 in expand_byte_code (jcf=0xb75ec000, method=0xb75ead00) at /scratch/gcc-4.6-20101009/gcc/java/expr.c:3155
#7  0x080faa5c in parse_class_file () at /scratch/gcc-4.6-20101009/gcc/java/jcf-parse.c:1658
#8  0x080fb325 in java_parse_file (set_yydebug=0) at /scratch/gcc-4.6-20101009/gcc/java/jcf-parse.c:1970
#9  0x0841a076 in compile_file (argc=34, argv=0xbffff504) at /scratch/gcc-4.6-20101009/gcc/toplev.c:919
#10 do_compile (argc=34, argv=0xbffff504) at /scratch/gcc-4.6-20101009/gcc/toplev.c:2363
#11 toplev_main (argc=34, argv=0xbffff504) at /scratch/gcc-4.6-20101009/gcc/toplev.c:2423
#12 0x08106deb in main (argc=34, argv=0xbffff504) at /scratch/gcc-4.6-20101009/gcc/main.c:36
(gdb)
Comment 2 Witold Baryluk 2010-10-21 23:06:00 UTC
gcc 4.5.1 with the same options compiled on this machine without problems.