https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105373
--- Comment #11 from Avi Kivity <avi at scylladb dot com> --- Created attachment 52899 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52899&action=edit simple(r) reproducer I was able to reduce it to something simple (102 lines), but I was only able to verify that wrong code is generated on the gimple level (where my understanding is very limited). Still, to my inexperienced eyes it looks like an object with a copy constructor is being copied bitwise. Compile with (gcc 11.3.1) g++ -Wfatal-errors -w -std=gnu++20 -march=westmere -fvisibility=hidden -c -o table.o table.i -fdump-tree-gimple -g and observe in table.i.006t.gimple: struct lw_shared_ptr D.2740 [value-expr: frame_ptr->D.2740_4_5]; and then frame_ptr->D.2741_4_5.__old4 = frame_ptr->D.2740_4_5; in other places, variables of the same type are copied using the copy constructor.