Difference in assembly

Manmeet Singh Johar manmeet.johar@conexant.com
Wed Dec 29 11:09:00 GMT 2004


Hello,
I am building cross compilers for SPARC variant for Cygwin and MingW 
hosts. In the process I am faced with a very peculiar problem. For the 
code shown below, though I am getting same assembly instructions in same 
sequence, but the registers used in add are swapped. O0 has no problem, 
but the problem comes in as soon as I compile with O1.
Code:
#include <stdio.h>
extern unsigned int index;
extern unsigned char arr[100];
int main(int argc, char *argv[])
{
    if(arr[index] != 0) printf("\n FATAL....") ;
    return 0;
}
I also built the cross compiler for linux and the assembly generated 
matches with the one generated by compiler on Cygwin. Could someone 
please help me out.
Regards
Manmeet



More information about the Gcc-bugs mailing list