https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88971
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Richard Biener from comment #1) > This is because it still needs to generate the std::string objects at the > caller > site (outside of the if (print)). This involves quite some code to get > rid of, and even at -O3 we do not inline basic_string::basic_string it seems > (ISTR that is out-of-line in the library): > > __asm__ __volatile__("mfence" : : : "memory"); > _6 = MEM[(const int *)&data + 4B]; > if (_6 > 0) > goto <bb 3>; [41.48%] > else > goto <bb 11>; [58.52%] > > <bb 3> [local count: 445388109]: > std::basic_string<char>::basic_string (&D.39204, "<", &D.39205); > _7 = MEM[(char * *)&D.39204]; > _8 = _7 + 18446744073709551592; > if (_8 != &_S_empty_rep_storage) > goto <bb 5>; [10.00%] > else > goto <bb 4>; [90.00%] Looks like you're using -D_GLIBCXX_USE_CXX11_ABI=0 but the OP is not.