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-20 23:26:54 +0200
commit1d91e40cb10a82c69091f3bf2b91ffd9837d7725 (patch)
treee12626e2a45a22fc64019cd90c7ab1e347678f09
parent2878dae725a94a7f6a3f52677b2ec78c93e93765 (diff)
downloadsparse-1d91e40cb10a82c69091f3bf2b91ffd9837d7725.tar.gz
gensel: controlling expression must be pointer-converted
Following the resolution of DR481, the controlling expression of a generic selection must be array-to-pointer converted and function-to-pointer converted. Do this by adding a call to degenerate(). Reported-by: Marco Elver <elver@google.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--evaluate.c4
-rw-r--r--validation/generic-dr481.c1
2 files changed, 3 insertions, 2 deletions
diff --git a/evaluate.c b/evaluate.c
index d8615a89..491dfa3c 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -3290,7 +3290,9 @@ static struct symbol *evaluate_generic_selection(struct expression *expr)
struct symbol source;
struct symbol *ctrl;
- if (!(ctrl = evaluate_expression(expr->control)))
+ if (!evaluate_expression(expr->control))
+ return NULL;
+ if (!(ctrl = degenerate(expr->control)))
return NULL;
source = *ctrl;
diff --git a/validation/generic-dr481.c b/validation/generic-dr481.c
index 2ed15c9b..a2d27b98 100644
--- a/validation/generic-dr481.c
+++ b/validation/generic-dr481.c
@@ -7,7 +7,6 @@ static char const* f = _Generic(+(int const){ 0 }, int const: "blu");
/*
* check-name: generic-dr481
- * check-known-to-fail
*
* check-error-start
generic-dr481.c:2:32: error: no generic selection for 'char *'