Article View: comp.bugs.sys5
Article #546Bug in portable C-compiler SYS V.2
From: bernd
Date: Fri, 12 Jun 1987 15:47
Date: Fri, 12 Jun 1987 15:47
60 lines
1722 bytes
1722 bytes
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
Technical Details
Message-ID:
<134@stollco.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!seismo!mcvax!unido!stollco!berndShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!seismo!mcvax!unido!stollco!bernd From: bernd@stollco.UUCP Newsgroups: comp.bugs.sys5,comp.lang.c Subject: Bug in portable C-compiler SYS V.2 Message-ID: <134@stollco.UUCP> Date: Fri, 12-Jun-87 11:47:47 EDT Article-I.D.: stollco.134 Posted: Fri Jun 12 11:47:47 1987 Date-Received: Sun, 14-Jun-87 21:42:26 EDT Organization: Stollmann Gmbh, D 2000 Hamburg 50 Lines: 60