Expansion cost of an expression should be a monotonically increasing function of its sub-expressions. Here, for the costs of calling a pure function, the costs is reset to zero (wich is used when the expression expand to a constant/to test if the expression is a constant or not). Fix this by setting the cost as the total expansion cost of all the arguments plus one for the function itself. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- expand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expand.c b/expand.c index 7af12707e..738c79c51 100644 --- a/expand.c +++ b/expand.c @@ -796,7 +796,7 @@ static int expand_symbol_call(struct expression *expr, int cost) return ctype->op->expand(expr, cost); if (ctype->ctype.modifiers & MOD_PURE) - return 0; + return cost + 1; return SIDE_EFFECTS; } -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html