gcc-20001027: Funny handling of sizeof()

Horst von Brand vonbrand@sleipnir.valparaiso.cl
Sat Oct 28 13:38:00 GMT 2000


Linux, Red Hat 7, i686

The line below (distilled from a macro for computing alignment) gets the
anoying and useless warning:

/tmp/tst.c:1: warning: large integer implicitly truncated to unsigned type

This warning disappears if sizeof(long) (a constant) is replaced by 4 (the
same constant!), or if the result is used to initialize an unsigned int.

int i = (5 + 4 - 1) & ~(sizeof(long)-1);
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Vin~a del Mar, Chile                               +56 32 672616


More information about the Gcc-bugs mailing list