https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111685
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- And it is definitely defined incorrectly. Adding a printf in the cmp: __builtin_printf("%p:%p\n", &a, &b); Gives: 0x12072b0:0x12072b0 0x12072b4:0x12072b0 0x7ffe9afcec9c:0x12072b0 0x12072b8:0x12072b0 0x7ffe9afcec9c:0x12072b4 Which means libstdc++ is calling the cmp on a temporary and you not getting the correct thing.