Hacker News new | ask | show | jobs
by ryao 531 days ago
Where did you find that note? I do not see it in the C standard draft I linked.
1 comments

It is in n3301, the last 202y draft. In the 201x draft it was note 95.
I see it now. I guess the GCC developers were wrong then.
I think it is a bit more complicated. The rule, together with the aliasing rule, if taken a face value, means you could do unrestricted aliasing as long as you cast to an union type on access. I believe that's the interpretation the GCC Devs reject as is makes TBAA ineffective.

Instead they interpret it narrowly to only allow punning through objects that are actual unions (as described in the GCC docs).

Unsurprisingly the standard is kind of a mess.