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 optimization/10955] New: wrong code for structure argument in context of structure return with -O3


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: wrong code for structure argument in context of
                    structure return with -O3
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: heinrich.brand@fujitsu-siemens.com
                CC: gcc-bugs@gcc.gnu.org

With Optimization -O3 wrong code is generated for function c5p.




#define COMPLEX struct CS


 


COMPLEX {


    long x;


    long y;


};


 


static


COMPLEX CCID (COMPLEX x){


    COMPLEX a;


    a.x = x.x;


    a.y = x.y;


    return a;


}




static


COMPLEX CPOW (COMPLEX x, int y){


    COMPLEX a;


    a = x;


    while (--y > 0) a=CCID(a);


    return a;


}




int c5p (COMPLEX x){


    COMPLEX a,b;


    a = CPOW (x, 2);


    b = CCID( CPOW(a,2) );


    return (b.x == b.y); 


}




int main () {


    COMPLEX  x;  


    x.x = -7;


    x.y = -7;


    if(c5p (x))printf("PASSED\n");else printf("FAILED\n");


    return 0;


}



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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