On Mon, Apr 14, 2008 at 09:21:47PM -0700, Brian Dessent wrote: > Harald van D?k wrote: > > > - Is this a known issue? I've searched for this error, but only got > > results requiring specific compiler options that aren't necessary to get > > it to fail here. I will report it as a bug if it's not known (and not > > already fixed by accident). > > This looks like <http://gcc.gnu.org/PR35261>. > > > - When I disable checking, GCC does not generate any error message. Can > > I expect that the code it generates will be correct, or might it be > > broken and going undetected? > > Disabling checking just papers over the real problem, which is an > internal inconsistency in gcc. Whether or not the generated code is > correct is unknown. Yes, and that was what I was curious about: I was wondering whether the optimiser is incorrect, or only the checks. If it turns out the checks are incorrect, there's no reason for me to doubt the rest, but I'm not at all familiar enough with GCC's structure to see what's going on. > > - What would you recommend as a workaround (other than disabling > > checking)? My first guess would be to remove __attribute__((__const__)), but > > that's not an option, as it's part of gtk, and not of the program > > itself. Do you have a good alternative? > > I'd add your testcase to that PR above, at least. You could also try > the current trunk and see if it's fixed there. Thanks, I've tried the most recent snapshots of 4.3 and 4.4, but they both fail the same way. I've attached a testcase that's a bit shorter to the bug.