diff options
author | Nicolai Stange <nicstange@gmail.com> | 2016-02-01 03:34:34 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-03-31 02:14:10 +0200 |
commit | c352b0d872b5c393d3ef1eb3053c19c298bcc82e (patch) | |
tree | 780adf6952189f8dbf5d3fbdce2e0b0d2e5b4812 /evaluate.c | |
parent | ccd9e3b5c6ab48bc03b52014a48ea53d681aa704 (diff) | |
download | sparse-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.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -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, <ype); rclass = classify_type(rtype, &rtype); |