SUN C compiler bug?
Chris Torek
chris at umcp-cs.UUCP
Sun Apr 6 16:18:22 AEST 1986
In article <215 at valid.UUCP> pete at valid.UUCP (Pete Zakel) writes:
>I tried [printf("%d\n", (0, 257)) and it failed, printing `1']. I
>assume it is a problem with any PCC based C compiler.
Not so: On a 4.3-beta Vax compiler, this will print 257. You
can get around the bug on Suns by forcing the constant to be `long':
f((0, 257L));
passes 257 to `f'.
This may be related to another bug, where
f((int)(char)(const));
will not sign extend the constant `const' (variables are properly
sign extended). Indeed, that problem also goes away if `const' is
a long constant, or if you use
f((int)(char)(int)(const));
It appears to be the result of an improperly executed attempt at
improving the code generated by small integer constants.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1415)
UUCP: seismo!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris at mimsy.umd.edu
More information about the Comp.lang.c
mailing list