Hacker News new | past | comments | ask | show | jobs | submit login

I find your conclusion very surprising, foo and bar are certainly not compatible. psbar->x is equivalent to (*psbar).x and dereferencing psbar violates the effective type rule, thus UB. The fact that the type of the 'x' fields are the same is immaterial as you are already in UB territory.

I believe that GCC uses a structural type system for its TBAA analysis (and generally much looser rules), but from the standard point of view it seems that this is a pretty clear violation of aliasing rules.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: