https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117217
Bug ID: 117217 Summary: ICE in tree-sra when copying struct with a union of packed structs with bitfields Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: llvm at rifkin dot dev Target Milestone: --- This ICEs gcc trunk and has done so since at least gcc 4.8: struct [[gnu::packed]] A { int i; bool b; }; struct [[gnu::packed]] B { int i; bool b : 1; }; struct E { union Data { A a; B b; Data(const B &b) : b(b) {} } data; }; extern B copy; int main() { E e{{B()}}; copy = e.data.b; // NEEDED FOR ICE } https://godbolt.org/z/WzK4cTPGd Initially found by Mark Polyakov