This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/6833] gcse generates wrong code with regard to global register variables


------- Additional Comments From bruno at clisp dot org  2004-06-15 16:56 -------
I think RTH's test case for BR #6722 should be sufficient. Anyway, if you want to commit this 
one too, it needs a small fix, namely to save and restore the value of the global variable. (Yes it 
may make a difference, if the caller of the main() function (in libc) uses %ebx for its own 
purposes.) 
 
======================================= 
register int* p __asm__("%ebx"); 
 
void foo() 
{ 
    --p; 
} 
 
int main() 
{ 
    int a[3] = { 0, 0, 0 }; 
    int *oldp = p; 
    int result; 
 
    p = a+2; 
    do *(p-1)=1; while (!p); 
    foo(); 
 
    result = *(p-1); 
    p = oldp; 
    return result; 
} 
======================================= 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6833


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]