Is there a website with non-UB C code snippets for stuff that is UB if done directly (like converting uint to int assuming twos complement)?
-
-
hmm.. cprover (cbmc) is not happy with that: "arithmetic overflow on signed to unsigned type conversion in (unsigned int)-1"
-
jfyi everyone: This version passes all cbmc checks (b is an uint64_t).pic.twitter.com/DKExVdRkeS
-
I prefer my version because it's algebraically obvious that the two branches collapse to the same thing, without thinking of def'n of ~.
End of conversation
New conversation -
-
-
Clang optimisations seems to exploit UB a lot more than GCC. It's annoying. It means C is no longer the next level of abstraction above asm.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Interestingly clang (but apparently not gcc) messes with integer wrap semantics. I need -fwrapv to get implementation defined semantics.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.