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)?
-
-
Replying to @oe1cxw
That example isn't UB, it's implementation-defined and pretty much universally accepted as appropriate.
1 reply 0 retweets 1 like -
Replying to @RichFelker @oe1cxw
But anyway, x>INT_MAX ? -1-(int)(-1-x) : x
3 replies 0 retweets 2 likes -
Replying to @RichFelker
hmm.. cprover (cbmc) is not happy with that: "arithmetic overflow on signed to unsigned type conversion in (unsigned int)-1"
3 replies 0 retweets 0 likes -
Replying to @oe1cxw @RichFelker
Pretty sure per the C standard that's required to produce 0U-1U - or UINT_MAX
2 replies 0 retweets 1 like -
Replying to @erincandescent @oshepherd and
I'd feel much more comfortable with a tool that took LLVM IR as input, instead of using its own (incomplete) C/C++ parser
1 reply 0 retweets 2 likes
IIRC LLVM IR has already lost some information about well-definedness.
11:25 AM - 4 Jul 2017
1 reply
0 retweets
1 like
-
-
yeah, I mostly mean not redoing the frontend
0 replies 0 retweets 1 likeThanks. 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.