From patchwork Fri Mar 1 23:06:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 777124 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp1604744wrn; Fri, 1 Mar 2024 15:20:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXTX9BUzh5lOo3x5ZiXEYS5T7epqVHxBCVJqmCGOSkrcZ/NIyay5ik/25LnVb8LE1qiLMtsy3eEm1hm0oR2JjRG X-Google-Smtp-Source: AGHT+IEr1TUc5N5YMXmN4W7XDx2EZcjmykPsKOB/YMXb6VQCDgYLS7QGEV+69VVLVItvCHWFdo3A X-Received: by 2002:a05:6870:698a:b0:21f:dfd8:e962 with SMTP id my10-20020a056870698a00b0021fdfd8e962mr3599577oab.0.1709335205441; Fri, 01 Mar 2024 15:20:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709335205; cv=none; d=google.com; s=arc-20160816; b=A68Axv3yvc3wTJ8ahyPdIR613WULLd7NkryhU6NnwQuANHWnwVcDwnDnS38xfSPsJF fDYna4cZz3sANRwo9MG1IZmHyBNbV1TtDo1+PkvzQDCBAdRtFq4dVRPRW293WQj38d98 LfXsMId/nNhmlZ+a3PnaZ4cmhAbg8khEdYuiiZWoYB5peqiMslQlSvNKnfjvwzaMyGwP D3mnCLyGtyy4pPRlBzFKP178PctfCG7pixU6Qk16P+ka7IHSKF3BoeZfYcfW/bKKE/qx gYSeuUCHG0jYL/do8t50WRQ1gsAw5HEauGdvEUsh7z1gnDJvJ3finnBfHKwgmyeV8U66 5v2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mnZ6WGfrFw+xqlID/o+DhOWiMwOEcHx/bjX2Yi5iHU4=; fh=Qh1fDyeKF6RN1RJuySFfPJyY198jyWlhb0GvHOCyqAQ=; b=ZmevUbj/7FaGiYQYSKxoq5DIcq48o7O6AHZO33bmu/rYmfcuy4Z3EsIi+rL18v0EBy IUG5M4a/TpCthN9x5ctZFF8b09mkYsq8JcJ4QZqpA+GyRekiT+bpA6jTUgwnfdWDwp4M zNEZIUzwtdcq2uG1t27zwTjWaasFFS94kDX6+7qNYLZeqV7BzWGsPb+GHCsLIY96HZC3 6c2raBGrWM5uJhRFBQGQjN/RMSIyI+M6q8//e6zOFwcItJ9dczqC/TTxTvVEBXyhaaxz Ne3t8k/u7Dh9qtOBFuYWs8q87caTJAbc0U7e1OTUzPAlh2VRI+BXbc/CAsw+0XYW5VRv /3eA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Fcp1o/8e"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b10-20020a05620a0f8a00b00787d6989706si4503651qkn.98.2024.03.01.15.20.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Mar 2024 15:20:05 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Fcp1o/8e"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rgC2d-0005fq-7V; Fri, 01 Mar 2024 18:11:47 -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 1rgC1h-0003xC-Dd for qemu-devel@nongnu.org; Fri, 01 Mar 2024 18:10:54 -0500 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rgC1f-0005tx-Pp for qemu-devel@nongnu.org; Fri, 01 Mar 2024 18:10:49 -0500 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-365c9d37995so8900715ab.0 for ; Fri, 01 Mar 2024 15:10:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709334644; x=1709939444; darn=nongnu.org; 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=mnZ6WGfrFw+xqlID/o+DhOWiMwOEcHx/bjX2Yi5iHU4=; b=Fcp1o/8eEYU+rAHbsGUFfNVqvaSxMiVYRpVqnpudw/WTgNzqt4niI7u4bxZRaDqMab kKsdjabPM2PK5vWHCMeTj/3z/tkPWipIKfPEJHT2qMx3E5S3HPqlo3ciRnmgqoZj4LPB LSz+UB5vINbNq3/VEh2xn428nlWmWOm5Wc8xYmWXGhULsovBhjHEeUnq8j6c50BfV8if U5HHzkG0s/kaxz9XFlDcasdIs4jiNvLDyMGRbFyUKeo19JIBAPF5lXGVrCKbVNhU9foB 9GQq55k4ArmR9BTzD0qBgss+Y7VxLt2U7kcqPCCF5JXFopzr9q+nBHTkBTPY7M0VOqzp j2yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709334644; x=1709939444; 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=mnZ6WGfrFw+xqlID/o+DhOWiMwOEcHx/bjX2Yi5iHU4=; b=bBbkX+sepe6tajrrhCi6Vew7PUfPoZL7pO+9Dt/+hEbfoU+XzQCtOJyFduGiFdR1zd epe3YMdKSfhPaDld9DZr2mUYZfLVxZZAWRkzyofLiADmYIQQK3epwkkgzQBXATOwozW/ vh3Etd+yH6RBQdgnvlR9FrhQLVY0QdnsiuDII0q1J6pNBp/Ssc1zNmE2Z+bvvnYqTnmQ 4eZiSzd54UFziUAjQXi7So+WoTI/hSjwSxk591knvQpZK1Igenxp2Ea9pzmJ666aW3Do CXgi1hkKAOB+e901wF5oxSGG2P03+allQeaugx0pYGcIY5w3/wtwUTqTQcbsUJrB1RiM xegg== X-Gm-Message-State: AOJu0Yyzlfvl3iHoqhBYj/FUxFz2l0+Y7xQMZFAxGl3Vf9aqCyXxv1Yf 8fxYDar70mcxxzfjvhxlSu43Xo9a5x1Q2n8iLYf+I6YxsuEJjIOqwAy5pWjKCdX1zdmensZRqnS D X-Received: by 2002:a05:6e02:2196:b0:363:c576:d6d5 with SMTP id j22-20020a056e02219600b00363c576d6d5mr3651397ila.4.1709334644356; Fri, 01 Mar 2024 15:10:44 -0800 (PST) Received: from stoup.. (098-147-055-211.res.spectrum.com. [98.147.55.211]) by smtp.gmail.com with ESMTPSA id c2-20020a634e02000000b005e438fe702dsm3449407pgb.65.2024.03.01.15.10.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 15:10:43 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 55/60] tcg/optimize: fix uninitialized variable Date: Fri, 1 Mar 2024 13:06:14 -1000 Message-Id: <20240301230619.661008-56-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240301230619.661008-1-richard.henderson@linaro.org> References: <20240301230619.661008-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::129; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x129.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Paolo Bonzini The variables uext_opc and sext_opc are used without initialization if TCG_TARGET_extract_i{32,64}_valid returns false. The result, depending on the compiler, might be the generation of extract and sextract opcodes with invalid offset and count, or just random data in the TCG opcode stream. Fixes: ceb9ee06b71 ("tcg/optimize: Handle TCG_COND_TST{EQ,NE}", 2024-02-03) Cc: Richard Henderson Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20240228110641.287205-1-pbonzini@redhat.com> Signed-off-by: Richard Henderson --- tcg/optimize.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 79e701652b..752cc5c56b 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2102,7 +2102,8 @@ static bool fold_remainder(OptContext *ctx, TCGOp *op) static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) { - TCGOpcode and_opc, sub_opc, xor_opc, neg_opc, shr_opc, uext_opc, sext_opc; + TCGOpcode and_opc, sub_opc, xor_opc, neg_opc, shr_opc; + TCGOpcode uext_opc = 0, sext_opc = 0; TCGCond cond = op->args[3]; TCGArg ret, src1, src2; TCGOp *op2;