http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55158
--- Comment #1 from Gary Funck <gary at intrepid dot com> 2012-11-01 00:15:54 UTC --- Some additional debugging information. In sched_rgn_init(), the bb_state array is initialized. 3049 { 3050 bb_state_array = (char *) xmalloc (last_basic_block * dfa_state_size); 3051 bb_state = XNEWVEC (state_t, last_basic_block); 3052 for (i = 0; i < last_basic_block; i++) 3053 { 3054 bb_state[i] = (state_t) (bb_state_array + i * dfa_state_size); 3055 3056 state_reset (bb_state[i]); 3057 } 3058 } For the given test case. (gdb) p last_basic_block $3 = 23 Yet, it is the access of bb_state[23] that leads to the segfault. The last basic block is 23, and the array bb_state[] is initialized only for entries 0..22. Perhaps the number entries allocated should be (last_basic_block + 1) with the initialization loop adjusted accordingly?