------- Comment #8 from dvilleneuve at kronos dot com 2009-12-19 14:41 ------- (In reply to comment #7) > *** Bug 42432 has been marked as a duplicate of this bug. *** >
Sorry for the duplicate. Seems I did not search enough... The resolution I've found for DR 257 is that there are no defects and that the standard does not need to be changed. The argument of DR 257 is about asking why the wording of 6.5.2.3#5 would be necessary (i.e., not redundant with the rest of the standard). DR 257 mentions 2 possibilities: a) padding: DR 257 rules that out, concluding that 6.5.2.3#5 is not needed for that case. b) aliasing from two different structs: DR 257 raises a special case with no common initial prefix and concludes on that specific case that 6.5.2.3#5 is not needed for that case too. However, the bug currently raised falls in neither a) nor b). It's about aliasing two different structs that actually have a common initial prefix. So maybe the wording of 6.5.2.3#5 is needed for _that_ case. But if we choose the interpretation brought by RTH in comment #1, to the effect that the common initial sequence should be accessed through a union, then there is no need for the wording of 6.5.2.3#5 specifying "anywhere that a declaration of the complete type of the union is visible", because it's not possible to access u.x.x without such a declaration in scope. Since resolution to DR 257 seems to confirm that the wording is the intended one (including that no words are meaningless and redundant), then the above interpretation cannot stand. Therefore, I would say that the mere visibility of the union when compiling f in the example instructs the compiler that xp and yp are possible aliases. Again from DR 257, if one wants to tell the compiler that no such aliasing occurs, the "restrict" keyword can then be used. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14319