https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102078

--- Comment #6 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #4)
> Full cppcheck error message is
> 
> gcc/ada/affinity.c:59:19: error: Signed integer overflow for expression
> '1<<index'. [integerOverflow]
> 
> I think cppcheck is worried if index runs up to 64, i.e. when sizeof(
> unsigned)
> is 8, hence my suggestion.
> 
> AFAIK, 1 << 31 loses the sign bit and so cppcheck likes to grumble, but 
> I've long since forgotten if it is actually UB or not.

Changing the 1 to 1UL seems to shut up cppcheck, so it looks like a
32/64 bit issue.

I guess there are some machines where unsigned int is 64 bit.

Reply via email to