3 ms·
For one, the linux kernel itself relies on this UB - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93031#c5 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93031#c5
by dzaima 3y ago
For one, the linux kernel itself relies on this UB - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93031#c5 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93031#c5, linked from OP.
And indeed linux would hit UBSAN reports on those, but just disables it if native unaligned load/store is configured - last paragraph of https://github.com/torvalds/linux/blob/706a741595047797872e669b3101429ab8d378ef/Documentation/dev-tools/ubsan.rst#L79 https://github.com/torvalds/linux/blob/706a741595047797872e6...
At present there's almost no reliance on this UB by compilers on something that actually has a chance of affecting real code, so it's not particularly unexpected that software appears to work.