bernd@stollco.UUCP (06/12/87)
After debugging an application we found that our
C-Compiler generates wrong inline code for 68881.
We used the portable C-compiler from Motorola
coming along with SYS V.2.
We are going to fix the bug, so I'm looking for help.
Maybe someone has encountered the same problem.
Any hint is welcome which part of the compiler sources is
responsible for the error.
The problem occurs in conditional expressions combined
with float convertion. Here comes a short example:
The false branch evaluates wrong.
With or without explicit typecast changes nothing.
test (l)
long l;
{
float f;
f= (l<0) ? -2.0 * l : (float) l;
}
Compiles to:
file "fperr.c"
data 1
text
global test
test:
link.l %fp,&F%1
movm.l &M%1,(4,%sp)
fmovm &FPM%1,(FPO%1,%sp)
tst.l (8,%fp)
bge L%_11
fmov.d &0xc000000000000000,%fp0
fmul.l (8,%fp),%fp0
fmov.x %fp0,%fp0
br L%_12
L%_11:
fmov.x %fp0,%fp0 <--- ?????
L%_12:
fmov.x %fp0,%fp0
fmov.s %fp0,((S%1-4).w,%fp)
L%12:
movm.l (4,%sp),&M%1
fmovm (FPO%1,%sp),&FPM%1
unlk %fp
rts
set S%1,0
set T%1,0
set F%1,-8
set FPO%1,4
set FPM%1,0x0000
set M%1,0x0000
data 1
--
Bernd Rennhak
TELE: +49 40 38900329
UUCP: ...{seismo}!unido!stollco!bernd