Not very surprisingly, I get ICEs at tree-sra.c:2148 when compiling these two examples with the current trunk at -O[123] on x86-64-linux:
====================================================================== union U { double d; __complex__ int c; }; double gd; extern double bar (union U); double foo (int b, double d, int c1, int c2) { union U u; double r; if (b) { u.d = d; r = u.d; } else { __real__ u.c = c1; __imag__ u.c = c2; r = bar (u); } return r; } ====================================================================== union U { __complex__ int ci; __complex__ float cf; }; float gd; extern float bar (union U); float foo (int b, double f1, double f2, int c1, int c2) { union U u; double r; if (b) { __real__ u.cf = f1; __imag__ u.cf = f2; } else { __real__ u.ci = c1; __imag__ u.ci = c2; } r = bar (u); return r; } ====================================================================== Hopefully I know what needs to be done. Martin -- Summary: ICE when SRAing partial assigments to complex number Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: jamborm at gcc dot gnu dot org ReportedBy: jamborm at gcc dot gnu dot org GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42196