aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-02-02 23:37:23 +0000
committerRichard Stallman <rms@gnu.org>1993-02-02 23:37:23 +0000
commit5abb45f22e162d6cc77d4cbefdbde01e36517555 (patch)
tree77532617067fc09306cfccca45dcdbc832082639
parente681c5a107b0106588049dfcad01511038a2c98f (diff)
downloadgcc-5abb45f22e162d6cc77d4cbefdbde01e36517555.zip
gcc-5abb45f22e162d6cc77d4cbefdbde01e36517555.tar.gz
gcc-5abb45f22e162d6cc77d4cbefdbde01e36517555.tar.bz2
(build_conditional_expr): Always convert and check
both result operands even if condition is constant. From-SVN: r3415
-rw-r--r--gcc/c-typeck.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 649467a..3cb6959 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -3584,9 +3584,6 @@ build_conditional_expr (ifexp, op1, op2)
= build_type_variant (result_type,
TREE_READONLY (op1) || TREE_READONLY (op2),
TREE_THIS_VOLATILE (op1) || TREE_THIS_VOLATILE (op2));
-
- if (TREE_CODE (ifexp) == INTEGER_CST)
- return convert_and_check (result_type, integer_zerop (ifexp) ? op2 : op1);
if (result_type != TREE_TYPE (op1))
op1 = convert_and_check (result_type, op1);
@@ -3629,6 +3626,9 @@ build_conditional_expr (ifexp, op1, op2)
}
}
#endif /* 0 */
+
+ if (TREE_CODE (ifexp) == INTEGER_CST)
+ return integer_zerop (ifexp) ? op2 : op1;
return fold (build (COND_EXPR, result_type, ifexp, op1, op2));
}