C compiler test
Gregory Smith
greg at utcsri.UUCP
Thu Jul 24 04:46:39 AEST 1986
In article <2477 at brl-smoke.ARPA> ucsch.pravda at ucb-vax.ARPA writes:
>
>On our VAX 11/750 running 4.2bsd I got the incorrect 3 and 4
>both normal and optimized.
>
>Maybe you see something in this (I'm no assembler wiz)?
:
( Comments mine:)
>L16: .double 0d2.5e+00
> .text
> cvtld -4(fp),r0 ; r0 = (double)i
> divd2 L16,r0 ; r0 = r0/2.5 ( double divide )
> cvtdl r0,r0 ; r0 = (int)r0
> movl r0,-4(fp) ; i = r0
:
>L19: .double 0d2.5e+00
> .text
> cvtdl L19,r0 ; r0 = (int)2.5 ( i.e. r=2 )
> divl2 r0,-4(fp) ; i=i/r0 ( integer divide )
So i /= 2.5 is incorrectly treated as i /= (int)2.5.
( This here VAX running 4.2BSD produces essentially the same code
for both and says 3,3).
--
"You'll need more than a Tylenol if you don't tell me where my father is!"
- The Ice Pirates
----------------------------------------------------------------------
Greg Smith University of Toronto UUCP: ..utzoo!utcsri!greg
More information about the Comp.lang.c
mailing list