This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/6833] gcse generates wrong code with regard to global register variables
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jun 2004 15:01:54 -0000
- Subject: [Bug rtl-optimization/6833] gcse generates wrong code with regard to global register variables
- References: <20020527043600.6833.bruno@clisp.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From reichelt at gcc dot gnu dot org 2004-06-15 15:01 -------
Hi Bruno,
you wrote:
> Still, could you add my testcase to the testsuite? Global register
> variables are not used by many programs, but GNU clisp relies on them
> very much. I'd like to not see this bug appear again.
Well, your testcase can be reduced to the following:
=======================================
register int* p __asm__("%ebx");
void foo()
{
--p;
}
int main()
{
int a[3] = { 0, 0, 0 };
p = a+2;
do *(p-1)=1; while (!p);
foo();
return *(p-1);
}
=======================================
The result should be zero, but gcc 3.1 returns something different :-(
As you noticed, the bug disappeared in gcc 3.2.
In fact, this PR is a duplicate of PR 6722, which got fixed by RTH
for gcc 3.2. He also added a similar testcase to the testsuite
which should cover this kind of problem.
So I'm reopening this PR...
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |reichelt at gcc dot gnu dot
| |org
Status|RESOLVED |REOPENED
Component|middle-end |rtl-optimization
Known to fail| |3.1
Known to work| |3.2
Resolution|FIXED |
Target Milestone|--- |3.1.x/3.2.x
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6833