Debugging ICE in GCC

Manfred Schwarb manfred99@gmx.ch
Sat May 30 23:46:17 GMT 2020


Am 30.05.20 um 09:39 schrieb Jonathan Wakely:
> On Sat, 30 May 2020 at 02:01, Manfred Schwarb <manfred99@gmx.ch> wrote:
>>
>> Hi,
>> I tried to debug fortran.dg/pr95090.f90, which showed
>>
>> f951: internal compiler error: Segmentation fault
>> 0x83cfe3c ???
>>         ../sysdeps/i386/start.S:117
>> Please submit a full bug report,
>> with preprocessed source if appropriate.
>> Please include the complete backtrace with any bug report.
>> See <https://gcc.gnu.org/bugs/> for instructions.
>>
>>
>> Using GDB (8.3.1), I got
>> #> f951="`$instdir/bin/gcc -print-prog-name=f951`"
>> #> gdb -ex run -ex bt --batch --args $f951 fortran.dg/pr95090.f90
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0xf7aa5162 in __strlen_sse2_bsf () from /lib/libc.so.6
>> #0  0xf7aa5162 in __strlen_sse2_bsf () from /lib/libc.so.6
>> #1  0x083e7c3f in get_unique_hashed_string(char*, gfc_symbol*) ()
>> #2  0x083e85a4 in gfc_find_derived_vtab(gfc_symbol*) ()
>> #3  0x0847fde1 in resolve_fl_derived(gfc_symbol*) ()
>> #4  0x0847c717 in resolve_symbol(gfc_symbol*) ()
>> #5  0x084a78d0 in do_traverse_symtree(gfc_symtree*, void (*)(gfc_symtree*), void (*)(gfc_symbol*)) ()
>> #6  0x08487f77 in resolve_types(gfc_namespace*) ()
>> #7  0x0847b6e5 in gfc_resolve(gfc_namespace*) ()
>> #8  0x0846e9f6 in gfc_parse_file() ()
>> #9  0x084bebe7 in gfc_be_parse_file() ()
>> #10 0x08a3b59e in compile_file() ()
>> #11 0x083c98a5 in toplev::main(int, char**) ()
>> #12 0x083cd9b1 in main ()
>>
>>
>> So far so good, but there are no file locations shown, and I can't
>> switch frames and list code in GDB.
>> This although I built GCC with debug information and binaries are not stripped.
>>
>> I built GCC with
>> #> ../configure --enable-checking=yes,extra i686-linux
>> #> make BOOT_CFLAGS="-O2 -ggdb" bootstrap2-lean
>>
>> In desperation, I even tried
>> #> make BOOT_CFLAGS="-O2 -fanalyzer" bootstrap2-lean
>> and
>> #> make BOOT_CFLAGS="-O2 -fsanitize=address" bootstrap2-lean
>> but both compilation attempts failed.
>>
>>
>> Are there any magic knobs to make GDB output more useful?
>
> There's a whole wiki page about that:
> https://gcc.gnu.org/wiki/DebuggingGCC
>

Thanks a lot for the pointer.
I didn't know about "--enable-valgrind-annotations" and "setarch -R".
But this does not help me getting gdb working.
As mentioned, gdb does not let me change frames or list code, unfortunately.

BOOT_CFLAGS="-O2 -fsanitize=address" would be really handy, it seems to me...


> You probably don't want to use -O2
>



More information about the Gcc-help mailing list