From: Richard Henderson Date: Fri, 3 Jan 2025 19:01:53 +0000 (-0800) Subject: tcg: Validate op supported in opcode_args_ct X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b277cdd20baf6d8579aa5a874f713f9e19833c9f;p=qemu.git tcg: Validate op supported in opcode_args_ct We should have checked that the op is supported before emitting it. The backend cannot be expected to have a constraint set for unsupported ops. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- diff --git a/tcg/tcg.c b/tcg/tcg.c index 32975fe298..b9119a1ec7 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3367,6 +3367,10 @@ static const TCGArgConstraint *opcode_args_ct(const TCGOp *op) const TCGOpDef *def = &tcg_op_defs[op->opc]; TCGConstraintSetIndex con_set; +#ifdef CONFIG_DEBUG_TCG + assert(tcg_op_supported(op->opc, TCGOP_TYPE(op), TCGOP_FLAGS(op))); +#endif + if (def->nb_iargs + def->nb_oargs == 0) { return NULL; }