-
Bug
-
Resolution: Fixed
-
High
-
Code Generation Tools
-
CODEGEN-12663
-
-
-
default
-
A ternary operator is often used in C to implement a max operation. For example, `x < y ? y : x`.
In rare cases, when:
1. Generating code for a ternary max operation and
2. When integer immediate values are used in the max operation
Then the compiler may generate incorrect code.
For example, `x > y ? x : y` may generate incorrect code.
If the inputs to the max operation are not immediate values, incorrect code will not be generated. However, due to optimization, it may be difficult to identify if inputs are immediates or not.
In these cases, incorrect code may manifest as an off-by-two error. For example, `a < 10` when `a < 12` is expected.
Ternary min idioms are not affected by this bug.