2 ms·
That misaligned access is UB and that gcc's particular behaviour is assuming alignment are two related but different things. The article says that both are true
by pron 7y ago
That misaligned access is UB and that gcc's particular behaviour is assuming alignment are two related but different things. The article says that both are true, and the title is simply the second, as that is the more impactful fact.
- eqvinox 7y agoI disagree that the second is more impactful, but that's because I work with oddball architectures where the UB actually crashes the program ;). I'm wondering though, does UBSAN catch this?
- saagarjha 7y agoIn my experience, yes, it’ll warn you if you access something aligned to the wrong boundary.
- pron 7y agoIf gcc crashed the program, then that would have been the headline. It's more interesting to know the actual behavior a popular compiler exhibits for a given UB, especially if it's a potentially harmful one, than the mere fact that something is a UB (which you can also just see in the standard).