There is a an assertion in `expr_evaluate_unary` that checks that the operand of the unary operation is not itself a unary expression. Add a check to `byteorder_conversion` to ensure that this is the case by removing an existing unary operation, rather than adding a second one. Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx> --- src/evaluate.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/evaluate.c b/src/evaluate.c index 1b252076e124..3f697eb1dd43 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -144,6 +144,14 @@ static int byteorder_conversion(struct eval_ctx *ctx, struct expr **expr, if ((*expr)->etype == EXPR_CONCAT) return 0; + /* Remove existing conversion */ + if ((*expr)->etype == EXPR_UNARY) { + struct expr *unary = *expr; + *expr = expr_get((*expr)->arg); + expr_free(unary); + return 0; + } + if (expr_basetype(*expr)->type != TYPE_INTEGER) return expr_error(ctx->msgs, *expr, "Byteorder mismatch: expected %s, got %s", -- 2.35.1