I miss a gcc warning

Andrew Haley aph-gcc@littlepinkcloud.COM
Thu Oct 25 14:00:00 GMT 2007


Tibor Vidók writes:

 > Porting an application to x86_64 I found a line, where I assign an
 > uintptr_t to an unsigned int an I wondered why I didnt get any
 > warning.
 > I definitely  remember that I got warnings in such cases before so I
 > tried to add some stupid lines to the code to get the warning, but I
 > couldn't make the code bad enough.
 > 
 > Is it a gcc-issue? or I forget to add some -Wxxx switches? Or gcc
 > should't wanr me in case of uintptr_t to <some small> cast?

uintptr_t is just a typedef for unsigned long int.  If you have a
warning for every assignment that caused a truncation you'd have an
awful lot of warnings.

Any use of uintptr_t should ring an alarm bell.  That's the real cause
of the bug, not anything else.  There are some real uses for
uintptr_t, but they are fairly obscure.

Andrew.



More information about the Gcc-help mailing list