From nobody Thu Dec 26 21:08:17 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1675112587; cv=none; d=zohomail.com; s=zohoarc; b=OSRxKwPCg/taCc1+zNPH+4N9kZxsLKN8MpJlm+WdmfhN1lsLZEVH4bXjRgIoYY+3VlPQ4SzEXmArEWnBQajNTzAzvX7yPN5sNDrOjmBsSOUmy0gOIYnkOOChPQquo+34DJJ5GC8Tb6LBM7TNF0ow2zVlEk/JYqgcV+o4w21cUsA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675112587; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RGdgdW64uwORmCGv84R5SKLfk4HZSsoCQbj1kTogu2U=; b=Hpbi4c3MOhY4mNGkEck0B3T4rjRAyDzQdSFnnnm26EBjE65bIB8zUg8uSB+dRc+1rA74adoIyZzV2MvXzsXkEILfqDPKgoZSc20SXdQtpr7BNDAB+enGRy0bWugHiy2jA3VH2UEj3Qxbere2O0LzHrNkUeJs+vSU0XKIh7RWgaE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1675112587365391.3236903128957; Mon, 30 Jan 2023 13:03:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pMbFv-0008Cc-K0; Mon, 30 Jan 2023 15:59:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMbFk-0007Ui-JY for qemu-devel@nongnu.org; Mon, 30 Jan 2023 15:59:52 -0500 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pMbFh-0005C8-TA for qemu-devel@nongnu.org; Mon, 30 Jan 2023 15:59:47 -0500 Received: by mail-pg1-x52b.google.com with SMTP id 141so8614043pgc.0 for ; Mon, 30 Jan 2023 12:59:43 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id x10-20020aa79a4a000000b00593eb3a5e44sm102933pfj.37.2023.01.30.12.59.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 12:59:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RGdgdW64uwORmCGv84R5SKLfk4HZSsoCQbj1kTogu2U=; b=zMTLhQF8Pxf9xgr7GbqxaELcNmD4wObiC4/SKB9dOS4SvlJdP0qwF9ot7YCWPE2hWG hRKjxBxsVj/pHeqfhbQ2qJznaKYOcW10zSmPMabUegPhX4Qd82TuQc7NmEKjuzwY6qoe pLHxE4EH4AejMGw26NmNgq66Lx3chJu+d2tZVVDulJNjA+Bk5t2NokQXaIiKY8WbaNjG E1DRM1i0/B1F3zrXQ3Y3XaQ1LcxXJmK7sPOVKHtthhWSfn0vXyxhjMaWGapXq2pWguiJ afWQZ6c1/99tFjcpqv2hLco+ITEsC8tsmti0yMLmPKrTu0r4ZTCGkJtmCKzUGojxnKN8 sQ5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RGdgdW64uwORmCGv84R5SKLfk4HZSsoCQbj1kTogu2U=; b=t8pJSTQoqe2vN7rBnZG7wm+o0d/UOO5qQsGb4EfgPJscmUzKW1oXebYXaP09AecOdo eVxXTQX0h104XzcADWYDEqN3jSyOIeacnTDcfYlXAOCgPlKzxq8O5+mhiowZIyDNQQd0 NNksB4PhPTtQRH8BnDrIsNWreZF5f308Kx05fzVd1jqel/KpDrjXfodjtTJ00U6faKPH KyM+dWFZDpjpdIgWIOD+rCr4wdTVaZJSlImORTxUHjDm5hoZjEVxNroRpTUrrQ3hV4Gs ztxqjxywsOyhCM1GTt+HE4Q5YhQPrI+pGx3gWCL7luSlRB/jm4yHF2V01QoX8FcZau5P dX6Q== X-Gm-Message-State: AFqh2koDu/2FXyszJddEz5vCvxxg6L8d/7dOfMFvtbRjr4GWHk+DHyw5 okak6APu2BnKpIoLoyJnhMoluunaIl85/TH4 X-Google-Smtp-Source: AMrXdXvUscvyvZgm6Yr7Di4lF2673Gvo0Eke0fFEENRA4sAg9pzQtvPScM+7qenzsrG9/2JyOgDOKQ== X-Received: by 2002:a62:be04:0:b0:58d:95aa:88a0 with SMTP id l4-20020a62be04000000b0058d95aa88a0mr46007393pff.24.1675112382147; Mon, 30 Jan 2023 12:59:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, cota@braap.org Subject: [PATCH 01/27] tcg: Adjust TCGContext.temps_in_use check Date: Mon, 30 Jan 2023 10:59:09 -1000 Message-Id: <20230130205935.1157347-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130205935.1157347-1-richard.henderson@linaro.org> References: <20230130205935.1157347-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1675112588749100005 Content-Type: text/plain; charset="utf-8" Change the temps_in_use check to use assert not fprintf. Move the assert for double-free before the check for count, since that is the more immediate problem. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tcg/tcg.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index fee96b3d9c..0bb0bdbe43 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1375,16 +1375,14 @@ void tcg_temp_free_internal(TCGTemp *ts) g_assert_not_reached(); } =20 -#if defined(CONFIG_DEBUG_TCG) - s->temps_in_use--; - if (s->temps_in_use < 0) { - fprintf(stderr, "More temporaries freed than allocated!\n"); - } -#endif - tcg_debug_assert(ts->temp_allocated !=3D 0); ts->temp_allocated =3D 0; =20 +#if defined(CONFIG_DEBUG_TCG) + assert(s->temps_in_use > 0); + s->temps_in_use--; +#endif + idx =3D temp_idx(ts); k =3D ts->base_type + (ts->kind =3D=3D TEMP_NORMAL ? 0 : TCG_TYPE_COUN= T); set_bit(idx, s->free_temps[k].l); --=20 2.34.1