Most function designators are just a symbol (normal function call) or some small expression for calls via a function pointer. But they can be arbitrary complex when if done via a statement expression or via an inline function. These expressions should be expanded to insure that sub-expressions involving 'sizeof()' or some other 'operators' taking a type as argument (like __builtin_compatible_types_p()) are no more present. However, this is not currently enforced causing some failure at linearization with warnings like: warning: unknown expression (4 0) (corresponding to EXPR_TYPE). Fix this by calling expand_expression() on function designator while expanding a function call. References: https://lore.kernel.org/lkml/1542623503-3755-1-git-send-email-yamada.masahiro@xxxxxxxxxxxxx/ Reported-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- expand.c | 2 ++ validation/expand/function-pointer.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/expand.c b/expand.c index 45e6f95e1..e8e50b080 100644 --- a/expand.c +++ b/expand.c @@ -821,6 +821,8 @@ static int expand_symbol_call(struct expression *expr, int cost) struct expression *fn = expr->fn; struct symbol *ctype = fn->ctype; + expand_expression(fn); + if (fn->type != EXPR_PREOP) return SIDE_EFFECTS; diff --git a/validation/expand/function-pointer.c b/validation/expand/function-pointer.c index 45aace161..706ef9a44 100644 --- a/validation/expand/function-pointer.c +++ b/validation/expand/function-pointer.c @@ -16,7 +16,6 @@ static void tst(struct s *s) /* * check-name: function-pointer * check-command: test-linearize -fdump-ir $file - * check-known-to-fail * * check-output-ignore * check-output-excludes: add\\.32.*\\$1, \\$0 -- 2.19.0