[Bug c/116193] enhancement: type attribute that causes overflow for unsigned integer types to trap
foss+gcc@alejandro-colomar.es
gcc-bugzilla@gcc.gnu.org
Mon Mar 16 21:18:12 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116193
Alejandro Colomar <foss+gcc@alejandro-colomar.es> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |foss+gcc@alejandro-colomar.
| |es
--- Comment #6 from Alejandro Colomar <foss+gcc@alejandro-colomar.es> ---
+1
I was just once again bitten by unsigned arithmetic. In this case, I had to
use id_t, because I'm handling uids and gids. I would be happy if
id_t,uid_t,gid_t were all signed integers, but that's not up to me to decide.
If I could at least mark them as non-wrapping integers, I'd be safe from these
bugs.
Since most unsigned integers are used where wrap-around is not intended, I
think it would be good to have something like -funsigned-overflow-traps and
then have an attribute to mark the few unsigned types where we do actually want
to wrap around.
More information about the Gcc-bugs
mailing list