*sigh* gcc <8 UBSan fails to catch this serious, trivial-to-make error:https://godbolt.org/z/kNil_u
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 *);
-
-
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.
-
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.
End of conversation
New conversation -
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.