Actually, it fails on 4.6 vanilla branch too, just not in GCC 4.6-RH, because we don't enable -fipa-sra by default for -O2/-Os for debug info quality reasons in 4.6, only for -O3 (that is something that is solved in GCC 4.7).
As for your workaround, if you only do it for GCC 4.6.* and not also for 4.7 and later, it is fine, all I would like is that such workarounds don't stick around forever for future versions of GCC.
Actually, it fails on 4.6 vanilla branch too, just not in GCC 4.6-RH, because we don't enable -fipa-sra by default for -O2/-Os for debug info quality reasons in 4.6, only for -O3 (that is something that is solved in GCC 4.7).
The regression started with http:// gcc.gnu. org/viewcvs? root=gcc& view=rev& rev=164135 which started building MEM_REF in the IPA-SRA codepath.
As for your workaround, if you only do it for GCC 4.6.* and not also for 4.7 and later, it is fine, all I would like is that such workarounds don't stick around forever for future versions of GCC.