https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92765
--- Comment #22 from Martin Sebor <msebor at gcc dot gnu.org> --- I've been going through the test cases here. IIUC, the one in comment #10 is a separate issue and should get its own bug. (Arguably, so is the one in comment #7.) It's unfortunate that GIMPLE doesn't preserve the basic property mentioned in comment #2. Not only does it make working with it error-prone (vis-a-vis this bug and others like it), it also prevents interesting optimizations, and makes warnings that depend on the property regardless inconsistent with the guarantees GCC does provide. I'm hoping this can change in the future. The only way I can think of to get all the test cases to pass, including the one comment #18 in particular, would be to disable the optimization for all struct members. But that seems unnecessary. As discussed in pr14319, GCC does expect the union type to be visible in accesses to overlapping members. Treating the test case in comment #18 as unsupported, A change that lets the remaining tests pass (i.e., all but those in comment #10 and comment #18) is much more selective: a) disable the optimization references containing a union among the handled components along the "access path" to the member, and b) use the maximum object size for PHI nodes (to let the test case in comment #7 pass).