This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to debug lto1 ICE?


Hello All

I just encountered a ICE from LTO. I hope I gave enough details in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41932

BTW, I am quite scared of the official policy of only preprocessed files in bugzilla. I feel it does not match well LTO issues. I tried to make a bug report as precise as possible.

Since it is a SIGSEGV ICE, I would have been happy to investigate it myself (even if today I don't know anything about LTO).

However, I have no idea of how and what to start under the debugger. Running the faulty gcc with gcc -v gives me
% gcc-trunk -v -flto -O2 -shared -o libcamlrun_shared.so interp.pic.o misc.pic.o stacks.pic.o fix_code.pic.o startup.pic.o freelist.pic.o major_gc.pic.o minor_gc.pic.o memory.pic.o alloc.pic.o roots.pic.o globroots.pic.o fail.pic.o signals.pic.o signals_byt.pic.o printexc.pic.o backtrace.pic.o compare.pic.o ints.pic.o floats.pic.o str.pic.o array.pic.o io.pic.o extern.pic.o intern.pic.o hash.pic.o sys.pic.o meta.pic.o parsing.pic.o gc_ctrl.pic.o terminfo.pic.o md5.pic.o obj.pic.o lexing.pic.o callback.pic.o debugger.pic.o weak.pic.o compact.pic.o finalise.pic.o custom.pic.o dynlink.pic.o unix.pic.o main.pic.o -lm -ldl -lcurses -lpthread
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk --libdir=/usr/local/lib/gcc-trunk --libexecdir=/usr/local/libexec/gcc-trunk --with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ --disable-multilib --enable-languages=c,c++ --enable-lto --enable-plugins --enable-maintainer-mode : (reconfigured) /usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk --libdir=/usr/local/lib/gcc-trunk --libexecdir=/usr/local/libexec/gcc-trunk --with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ --disable-multilib --enable-languages=c,c++ --enable-lto --enable-plugins --enable-maintainer-mode : (reconfigured) /usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk --libdir=/usr/local/lib/gcc-trunk --libexecdir=/usr/local/libexec/gcc-trunk --with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ --disable-multilib --enable-lto --enable-plugins --enable-maintainer-mode --enable-languages=c,c++,lto --no-create --no-recursion : (reconfigured) /usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk --libdir=/usr/local/lib/gcc-trunk --libexecdir=/usr/local/libexec/gcc-trunk --with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ --disable-multilib --enable-lto --enable-plugins --enable-maintainer-mode --enable-languages=c,c++,lto --no-create --no-recursion : (reconfigured) /usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk --libdir=/usr/local/lib/gcc-trunk --libexecdir=/usr/local/libexec/gcc-trunk --with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ --disable-multilib --enable-lto --enable-plugins --enable-maintainer-mode --enable-languages=c,c++,lto --no-create --no-recursion
Thread model: posix
gcc version 4.5.0 20091103 (experimental) (GCC)
COMPILER_PATH=/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/:/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/:/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/:/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/:/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/
LIBRARY_PATH=/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/:/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-flto' '-O2' '-shared' '-o' 'libcamlrun_shared.so' '-mtune=generic'


/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/collect2 -flto --eh-frame-hdr -m elf_x86_64 -shared -o libcamlrun_shared.so /usr/lib/../lib64/crti.o /usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/crtbeginS.o -L/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0 -L/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/../../.. interp.pic.o misc.pic.o stacks.pic.o fix_code.pic.o startup.pic.o freelist.pic.o major_gc.pic.o minor_gc.pic.o memory.pic.o alloc.pic.o roots.pic.o globroots.pic.o fail.pic.o signals.pic.o signals_byt.pic.o printexc.pic.o backtrace.pic.o compare.pic.o ints.pic.o floats.pic.o str.pic.o array.pic.o io.pic.o extern.pic.o intern.pic.o hash.pic.o sys.pic.o meta.pic.o parsing.pic.o gc_ctrl.pic.o terminfo.pic.o md5.pic.o obj.pic.o lexing.pic.o callback.pic.o debugger.pic.o weak.pic.o compact.pic.o finalise.pic.o custom.pic.o dynlink.pic.o unix.pic.o main.pic.o -lm -ldl -lcurses -lpthread -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/crtendS.o /usr/lib/../lib64/crtn.o
Using built-in specs.
COLLECT_GCC=/usr/local/bin/gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk --libdir=/usr/local/lib/gcc-trunk --libexecdir=/usr/local/libexec/gcc-trunk --with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ --disable-multilib --enable-languages=c,c++ --enable-lto --enable-plugins --enable-maintainer-mode : (reconfigured) /usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk --libdir=/usr/local/lib/gcc-trunk --libexecdir=/usr/local/libexec/gcc-trunk --with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ --disable-multilib --enable-languages=c,c++ --enable-lto --enable-plugins --enable-maintainer-mode : (reconfigured) /usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk --libdir=/usr/local/lib/gcc-trunk --libexecdir=/usr/local/libexec/gcc-trunk --with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ --disable-multilib --enable-lto --enable-plugins --enable-maintainer-mode --enable-languages=c,c++,lto --no-create --no-recursion : (reconfigured) /usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk --libdir=/usr/local/lib/gcc-trunk --libexecdir=/usr/local/libexec/gcc-trunk --with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ --disable-multilib --enable-lto --enable-plugins --enable-maintainer-mode --enable-languages=c,c++,lto --no-create --no-recursion : (reconfigured) /usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk --libdir=/usr/local/lib/gcc-trunk --libexecdir=/usr/local/libexec/gcc-trunk --with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ --disable-multilib --enable-lto --enable-plugins --enable-maintainer-mode --enable-languages=c,c++,lto --no-create --no-recursion
Thread model: posix
gcc version 4.5.0 20091103 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-combine' '-c' '-o' '/tmp/ccKdeyrC.lto.o' '-v' '-O2' '-shared' '-mtune=generic'
/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/lto1 -quiet -dumpbase interp.pic.o -mtune=generic -auxbase-strip /tmp/ccKdeyrC.lto.o -O2 -version @/tmp/ccJMSLwC -o /tmp/ccODq2S4.s
GNU GIMPLE (GCC) version 4.5.0 20091103 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.5.0 20091103 (experimental), GMP version 4.3.1, MPFR version 2.4.1-p2, MPC version 0.7
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU GIMPLE (GCC) version 4.5.0 20091103 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.5.0 20091103 (experimental), GMP version 4.3.1, MPFR version 2.4.1-p2, MPC version 0.7
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
gc_ctrl.c:44:16: warning: type of 'caml_major_heap_increment' does not match original declaration
major_gc.c:33:8: note: previously declared here
lto1: 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.
lto-wrapper: /usr/local/bin/gcc-trunk returned 1 exit status
collect2: lto-wrapper returned 1 exit status



But with the above details, how can I figure out how to run gdb, ie what arguments to give to gdb --args?


I suppose the offending process is probably
/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/lto1 -quiet -dumpbase interp.pic.o -mtune=generic -auxbase-strip /tmp/ccKdeyrC.lto.o -O2 -version @/tmp/ccJMSLwC -o /tmp/ccODq2S4.s


But I am not sure to understand correctly, in particular the @/tmp/ccJMSLwC argument puzzles me. Apparently, some program arguments are collected in some temporary files....

So how do I run lto1 under GDB, knowing the faulty gcc invocation?

Regards.

--
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]