*sigh* gcc <8 UBSan fails to catch this serious, trivial-to-make error:https://godbolt.org/z/kNil_u
-
Show this thread
-
Replying to @RichFelker
oh ffs. post a proper explanation (for those of 1.5k+ that follow you who are there to learn, not blindly hate), delete this crap, or I'll unfollow
2 replies 0 retweets 0 likes -
Replying to @_monoid @RichFelker
linked sample makes little sense and correctly elicits an enabled-by-default warning
1 reply 0 retweets 0 likes -
Replying to @_monoid
The context here is a stupid error I made in musl, which I expected there would be a warning option to catch, but I couldn't find one. The warning that was produced was a mistake in my godbolt-minimized test case; should have been: void bar(void *);
1 reply 0 retweets 0 likes -
Replying to @RichFelker @_monoid
The UB that's failing to be caught before gcc 8 here is pointer arithmetic applied to an array of length 1 with a constant offset greater than 1. It's the result of using & on an array where decayed pointer-to-first-element was what was actually wanted.
1 reply 0 retweets 0 likes
Here's an updated test case: https://godbolt.org/z/IPV9Q9 The function bar() is just to get the pointer to leak to external code as a barrier against optimization. The void* matches the real-world example it came from, where the function was memcpy.
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.