Conditional Expressions - GNU Compiler Collection (GCC) Internals
Description: GNU Compiler Collection (GCC) Internals

Next: Logical Operators, Previous: Compound Lvalues, Up: Operands

#### 12.5.3 Conditional Expressions

A C `?:` expression is converted into an `if` statement with each branch assigning to the same temporary. So,

         a = b ? c : d;

becomes

         if (b == 1)
           T1 = c;
         else
           T1 = d;
         a = T1;

The GIMPLE level if-conversion pass re-introduces `?:` expression, if appropriate. It is used to vectorize loops with conditions using vector conditional operations.

Note that in GIMPLE, `if` statements are represented using `GIMPLE_COND`, as described below.