https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70171
Seth LaForge <sethml at ofb dot net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sethml at ofb dot net --- Comment #1 from Seth LaForge <sethml at ofb dot net> --- Created attachment 37929 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37929&action=edit Example C code (does not demonstrate problem!) And, fascinatingly, the problem does not manifest with the C compiler! The equivalent C code attached generates the same assembly for all four functions. So it's something to do with C++ semantics for the ternary operator (presumably because in C++ the ternary returns an lvalue while in C it returns an rvalue?).