The mainline compiler for sh4-*-linux-gnu segfaults with -O2 on the program:
struct state { int retrans; int retry; int options; char pad[4]; }; extern __thread struct state *res __attribute__ ((tls_model ("initial-exec"))); void foo (void) { if (!res->retrans) res->retrans = 5; if (!res->retry) res->retry = 4; if (!res->options) res->options = 1; } in gcse.c:pre_insert_copy_insn. It starts to fail after the patch r107456: 2005-11-24 Paolo Bonzini <[EMAIL PROTECTED]> * gcse.c (hash_scan_set): Look through REG_EQUAL or REG_EQUIV notes also when doing PRE, rather than only for global CPROP. -- Summary: Segmentation fault in pre_insert_copy_insn Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kkojima at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: sh4-*-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25115