Re:Signed Integers Are Two’s Complement
by caf on Thursday May 31, 2018 @12:09AM
(#17193876)
However it also prevents "abort on overflow" implementations from being conforming, which look like a much better way of finding actual overflow bugs in the code.
[ Parent
| on HN ]
Do such implementations currntly only abort on signed overflow and not on unsigned overflow? Aborting on unsigned overflow is currently not conforming, is it?
It is not conforming, which is why `-fsanitize=unsigned-integer-overflow` is not enabled by default by ubsan. However it is available if you want to try it.
Re:Signed Integers Are Two’s Complement
by DoofusOfDeath on Thursday May 31, 2018 @01:05AM
(#17194090)
That's a question of static vs. dynamic analysis for bug detection.
Which one(s) is/are most useful depends on the user's needs.
Static analysis was always possible, dynamic isn't if you want to remain standard-compliant and overflow is defined.
That being said I think it's a rather weak justification for making overflow UB, after all if you want to trap on overflows wouldn't want to catch unsigned overflow as well?