[Bug libstdc++/81749] std::align: runtime error: negation of 8 cannot be represented in type 'size_t'
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Aug 7 11:23:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81749
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Strictly speaking, unsigned overflow doesn't even exist. "Integer overflow" is
only something that happens for signed integers. Operations on unsigned
integers have defined behaviour, they can't "overflow".
The C++ standard is clear what happens here: "The negative of an unsigned
quantity is computed by subtracting its value from 2^n , where n is the number
of bits in the promoted operand. The type of the result is the type of the
promoted operand."
More information about the Gcc-bugs
mailing list