An approach to hunting down compiler flaws that cause things like Segmentation faults

By: Fergus Henderson <fjh@cs.mu.OZ.AU>

Configure GCC with --enable-checking.  Compile it with -g so that you can use gdb.

Compile your test case with -v -da -Q.

Next, use gdb to get a stack trace.  Compile the compiler with debugging enabled (-g), use the -v option to see how cc1 is getting invoked, and then do

bash$ gdb cc1
gdb> run <arguments>
… (it will stop at the Seg fault)
gdb> where

gdb> list

Print out the values of interesting variables (e.g. the ones in the statement which got a segmentation fault).

You can use the pt and pr macros from the gdbinit.in file to display them.  For example, if there is a value of type tree named t, and a value of type rtx named r, you can use these commands:

gdb> source .gdbinit
gdb> print t
gdb> pt
gdb> print r
gdb> pr
gdb> pt