public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Difference in assembly
@ 2004-12-29 11:09 Manmeet Singh Johar
  2004-12-31  7:41 ` Manmeet Singh Johar
  0 siblings, 1 reply; 2+ messages in thread
From: Manmeet Singh Johar @ 2004-12-29 11:09 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Difference in assembly
  2004-12-29 11:09 Difference in assembly Manmeet Singh Johar
@ 2004-12-31  7:41 ` Manmeet Singh Johar
  0 siblings, 0 replies; 2+ messages in thread
From: Manmeet Singh Johar @ 2004-12-31  7:41 UTC (permalink / raw)
  To: gcc-bugs

Has anybody faced with such a problem? Please do help me out.
regards
manmeet

Manmeet Singh Johar wrote:

> 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
>
>

-- 
Manmeet Singh Johar
Software Engineer
Conexant
(+91-93120-54285)
"Forget yourself and you will not be forgotten."


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-12-31  7:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-29 11:09 Difference in assembly Manmeet Singh Johar
2004-12-31  7:41 ` Manmeet Singh Johar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).