This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Wrong code generated for Hitachi SH
- To: gcc at gcc dot gnu dot org
- Subject: Wrong code generated for Hitachi SH
- From: Michael Schwingen <michaels at stochastik dot rwth-aachen dot de>
- Date: Wed, 22 Mar 2000 11:15:50 +0100
Hello,
I have a problem when cross-compiling for sh-coff. The following program
unsigned int test(unsigned int x)
{
return 1000 + x;
}
yields the following result when compiling with -O2:
/opt/cgcc/bin/sh-coff-gcc -fomit-frame-pointer -m3 -O2 -S hello.c
.file "hello.c"
.data
gcc2_compiled.:
___gnu_compiled_c:
.text
.align 4
.global _test
_test:
mov.w L3,r0
rts
nop
.align 1
L3:
.short 1000
As you can see, the addition is never performed - the routine always returns
1000.
(leaving out -fomit-frame-pointer or -m3 changes nothing, and with -O1 the
output is fine).
This happens with both gcc-2.95.2 and the 20000221 snapshot (the 20000230
snapshot does not compile). egcs 1.1b did not have this problem. The same
compiler, built for a powerpc-eabi target, produced correct code.
This happens both on a linux-i686 and a cygwin host.
Any ideas?
cu
Michael
--
In the beginning there was nothing, which exploded.