This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: I miss a gcc warning


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]