egcs-1.0.3: mc68k/mcf5200 codegen bug when optimizing
Rune SkÃÂ¥rsmoen
skars@nvg.ntnu.no
Wed Jul 1 04:11:00 GMT 1998
target=m68k-coff, crosscompiling (from both sun/solaris2 and
{m68k|i586}-linux)
egcs-1.0.2 and egcs-1.0.3(a)
The following function generates illegal opcodes for ColdFire when
optimizing. compiler call: m68k-coff-gcc -O2 -m5200 -S func.c
short
func(void)
{
unsigned char x, y;
return y | x << 8;
}
This doesn't happen when func() returns an int instead of a short, or when
x and y are signed.
.file "func.c"
gcc2_compiled.:
__gnu_compiled_c:
.text
.even
.globl func
func:
link.w %a6,#0
and.w #0xFF,%d0 | illegal for coldfire
and.w #0xFF,%d1 | ditto
lsl.l #8,%d1
or.l %d1,%d0
ext.l %d0
unlk %a6
rts
Is this enough information for a fix?
More information about the Gcc-bugs
mailing list