------- Comment #10 from rguenth at gcc dot gnu dot org 2008-08-04 20:27 ------- The middle-end expects that if there is variable of record type T that for a component-reference it can walk its fields and find the one used as operand 1 in the component-reference.
If you look at the tree in commend #4 as it reaches the middle-end then this is not the case. SRA tries to deal with this by doing case FIELD_DECL: /* Fields are unique within a record, but not between compatible records. */ if (DECL_FIELD_CONTEXT (ae) == DECL_FIELD_CONTEXT (be)) return false; return fields_compatible_p (ae, be); but fields_compatible_p returns false because if (!types_compatible_p (TREE_TYPE (f1), TREE_TYPE (f2))) return false; returns false. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37016