aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-06-19 15:01:10 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-06-19 16:02:04 +0200
commit2878dae725a94a7f6a3f52677b2ec78c93e93765 (patch)
tree7c9a78f8e2337ebcc83baa80a0da56888ffe1ac1
parent383e7d4f1b745057d73abc3bbf3d6f2b6f47ffc2 (diff)
downloadsparse-2878dae725a94a7f6a3f52677b2ec78c93e93765.tar.gz
gensel: controlling expression must be lvalue converted
Following the resolution of DR481, the controlling expression of a generic selection must be lvalue converted. In other words, the qualifiers must be ignored. Reported-by: Marco Elver <elver@google.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--evaluate.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/evaluate.c b/evaluate.c
index cf40eed4..d8615a89 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -3287,17 +3287,20 @@ static struct symbol *evaluate_generic_selection(struct expression *expr)
{
struct type_expression *map;
struct expression *res;
+ struct symbol source;
struct symbol *ctrl;
if (!(ctrl = evaluate_expression(expr->control)))
return NULL;
+ source = *ctrl;
+ source.ctype.modifiers &= ~(MOD_QUALIFIER|MOD_ATOMIC);
for (map = expr->map; map; map = map->next) {
struct symbol *stype = map->type;
if (!evaluate_symbol(stype))
continue;
- if (!type_selection(ctrl, stype))
+ if (!type_selection(&source, stype))
continue;
res = map->expr;