ron@oscvax.UUCP (Ron Janzen) (04/16/86)
There is a problem in the Atari Developer's Kit when using the
C modulo operator (%) when both operands are longs. The problem
appears in the following way. Consider this short program,
#include <stdio.h>
main()
{
long i;
for ( i = 0; i < 10; i++ )
printf( "i = %ld, i %% 3 = %ld\n", i, i % 3L );
}
If you compile this and link it with gemlib it will work as expected.
However if you link it with vdibind and gemlib (as you would in a
program that uses VDI routines) in that order, the result of the i % 3L
operation is garbage. We traced it down to the fact that both vdibind
and gemlib contain the lrem function which is used when finding the
modulo of two longs. Evidently the one in vdibind is buggy whereas the
one in gemlib works. Therefore when we linked with vdibind before
gemlib the buggy version was linked in. It seems to me that vdibind
shouldn't even contain this routine (it also contains lmul.o and
ldiv.o). These routines should be (and are) in the C runtime library
(gemlib). We just took them out of vdibind and everything works OK now.
Is there some reason these routines were in vdibind?
--
Ron Janzen
Ontario Science Centre, Toronto
...!{allegra,ihnp4,linus,decvax}!utzoo!oscvax!ron