Red Hat Bugzilla – Bug 57027
gcc 2.96 miscompiles some constructs with optimization -O2 or -O3
Last modified: 2007-04-18 12:38:32 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR
Description of problem:
Quote from correspondence with Jakub:
The problem is with const in const Move move argument - the readonly
argument is first loaded into normal r/w pseudo register, then regmove
decides (seeing the pseudo is not read-only) to merge 2 different pseudo
registers together (move>>15 with move, since move is not used after that),
later on due to high register preassure reload reloads this into the stack
slot of the move argument (which is marked as unchanging though, because
argument is const) and later on flow just kills the move=move>>15, since
memory is marked read-only. In fact, all gccs up to 3.0.x are just papering
over this issue AFAIK, in gcc 3.1 this is solved for good.
Short term I'd propose you just get rid of the "const" in const Move move,
since you don't gain anything from it, I'll see if I can do something about
it such that it doesn't destabilize the compiler and doesn't result in
severe performance regressions either.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Jakub knows...
Argh. No test case, or even a pointer to a test case. But quote
from Jakub says this is fixed for gcc 3.1, so I'll believe him.