From: David Miller <da...@davemloft.net> Date: Wed, 26 Oct 2011 23:07:11 -0400 (EDT)
> From: Alan Modra <amo...@gmail.com> > Date: Thu, 27 Oct 2011 13:29:56 +1030 > >> Some recent patch has exposed a reload bug. I'm seeing > > I think this might be a side effect or Eric's recent changes, > CC:'d. Eric, I'm seeing a similar segmentation fault in reload on sparc64. But it's in a slightly different place than Alan's crash. Simply compile gcc.target/ultrasp12.c with "-m64 -O2 -mcpu=ultrasparc -mvis" to see this. The crash is in find_valid_class() called from push_reload(), via this code block around line 1184 of reload.c: enum reg_class in_out_class = find_valid_class (outmode, GET_MODE (SUBREG_REG (out)), subreg_regno_offset (REGNO (SUBREG_REG (out)), GET_MODE (SUBREG_REG (out)), SUBREG_BYTE (out), GET_MODE (out)), REGNO (SUBREG_REG (out))); 'out' is: (subreg:DI (reg/v:V4QI 50 %f18 [orig:314 s2hi4_ ] [314]) 0) so subreg_regno_offset() returns -1, and find_valid_class() isn't too happy about getting "-1" for it's 'n' argument. I suspect the test that you removed in order to fix rtl-optimization/46603 would guard against this happening. And indeed, I confirmed that backing out the rtl-optimization/46603 fix makes the segmentation fault go away.