aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/evaluate.c
diff options
context:
space:
mode:
authorNicolai Stange <nicstange@gmail.com>2016-02-01 03:34:34 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-03-31 02:14:10 +0200
commitc352b0d872b5c393d3ef1eb3053c19c298bcc82e (patch)
tree780adf6952189f8dbf5d3fbdce2e0b0d2e5b4812 /evaluate.c
parentccd9e3b5c6ab48bc03b52014a48ea53d681aa704 (diff)
downloadsparse-c352b0d872b5c393d3ef1eb3053c19c298bcc82e.tar.gz
constexpr: examine constness of conditionals at evaluation only
Move the whole calculation of conditional expressions' constness flags to the evaluation phase such that expressions like 0 ? __builtin_choose_expr(0, 0, 0) : 0 0 ? 0 : __builtin_choose_expr(0, 0, 0) can now be recognized as qualifying as integer constant expressions. Signed-off-by: Nicolai Stange <nicstange@gmail.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'evaluate.c')
-rw-r--r--evaluate.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/evaluate.c b/evaluate.c
index 07788eac..6d6e462c 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -1122,12 +1122,8 @@ static struct symbol *evaluate_conditional_expression(struct expression *expr)
true = &expr->cond_true;
}
- if (expr->flags) {
- int flags = expr->conditional->flags & CEF_ICE;
- flags &= (*true)->flags & expr->cond_false->flags;
- if (!flags)
- expr->flags = CEF_NONE;
- }
+ expr->flags = (expr->conditional->flags & (*true)->flags &
+ expr->cond_false->flags & ~CEF_CONST_MASK);
lclass = classify_type(ltype, &ltype);
rclass = classify_type(rtype, &rtype);