[net.micro.amiga] Manx C bug

rokicki@Navajo.ARPA (Tomas Rokicki) (04/04/86)

Finally been bitten by a bug in the new compiler.  The following
code will not work:

int test(a, b)
int a, b ;
{
   register long t = a * (long) b ;
}

The (long) coercion is required by the C standard to insure the
result is considered a long.  This only happens when both arguments
are int parameters and a long is required; taking out the coercion
yields the proper result in Aztec C.  (I don't think it should by
the standard C definition, though; an int expression assigned to
a long should yield a result with the bits sign-extended).

This bug did not happen in over 28,000 lines of C I have compiled
and successfully run under Manx C; it only happened when I rewrote
one 20-line library routine.  Thank God for small favors.   -tom