https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78947
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2016-12-29 Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed, this is fold-cost folding: (bool)(a?b:c) into a ? (bool) b : (bool)c; early. Rewriting the code slightly gets the code you wanted: bool condSet(int cond, int a, int b) { int c; c = cond ? a : b; return c; }