https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124223
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to stano from comment #4) > While to my knowledge the cast of a value that cannot be represented by the > target type is an implementation defined behavior and strictly speaking the > code is invalid, I would nevertheless like to submit the report, as what > happened was a bit surprising and most developers think of such casts as > bitwise copies. The problem is not the cast, the cast is fine. The problem is the subtraction, which produces a value that is out of range of int.
