------- Comment #5 from david dot kirkby at onetel dot net 2009-06-23 00:04
-------
Thinking about this more, why should it matter if the type being printed is of
a smaller size than the print statement. This clearly works ok,
drkir...@kestrel:[~] $ cat test2.c
#include <stdio.h>
int main() {
printf ("%lu\n",2);
}
drkir...@kestrel:[~] $ gcc test2.c
drkir...@kestrel:[~] $ ./a.out
2
The other point I forgot to mention is that the output of the first test
program changes if the code is compiled as 64-bit.
drkir...@kestrel:[~] $ gcc -m64 test.c
drkir...@kestrel:[~] $ ./a.out
9223372036854775808
2
drkir...@kestrel:[~] $ gcc -m32 test.c
drkir...@kestrel:[~] $ ./a.out
2147483648
2
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40524