Bug 26619 - Compiler fails to correctly initialize global reg variable
Summary: Compiler fails to correctly initialize global reg variable
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-09 13:55 UTC by dave.mueller
Modified: 2006-03-09 14:03 UTC (History)
1 user (show)

See Also:
Host: i686-gnu-linux
Target: arm-linux, powerpc-linux
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
ARM/PowerPC .i file (114 bytes, text/plain)
2006-03-09 13:59 UTC, dave.mueller
Details
PowerPC .s file (160 bytes, text/plain)
2006-03-09 14:00 UTC, dave.mueller
Details
ARM .s file (221 bytes, text/plain)
2006-03-09 14:01 UTC, dave.mueller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dave.mueller 2006-03-09 13:55:26 UTC
GCC 4.1.0 initializes another register than the one specified in the definition. 
I'm not sure it this has also something to do with bug 21596. 
The same testcase built with GCC 3.4.4 is correct.
Comment 1 dave.mueller 2006-03-09 13:59:43 UTC
Created attachment 11009 [details]
ARM/PowerPC .i file
Comment 2 dave.mueller 2006-03-09 14:00:09 UTC
Created attachment 11010 [details]
PowerPC .s file
Comment 3 dave.mueller 2006-03-09 14:01:26 UTC
Created attachment 11011 [details]
ARM .s file
Comment 4 Andrew Pinski 2006-03-09 14:02:30 UTC
local register variables don't do what you think they do.   Hint they only work with inline-asm.

Comment 5 Andrew Pinski 2006-03-09 14:03:40 UTC
If you want to use r5 the correct way is to do:
register int *foo asm("r5") = 0;
void t1(void)
{
    *foo = 1;
}