From nobody Sat May 4 00:05:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1590367518; cv=none; d=zohomail.com; s=zohoarc; b=P5+JMxxXiR3FFsMKqNqdEZVkKRsjs4RxQGLc+VeEFSaLcDfLeuZu/fM4nWtojjWnABsxzUVzWUZYNdBJ7ACKHb4Yfl9ZuxTeJoGLY0zxXddg3oZeu/kg2nL59DXvHx3/UofYbXLbuiNvOezyrM/kA2tPx+1TGTHua/jTD3Hse24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590367518; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=P8RrrDncw9cLMOwbVe2eVW0WWaz4iq9FuWQ879jZAg8=; b=Ltcle7X92R5r2EXM8Zdkgk96H3S07VCCaPw519aSn3ZiD9EYWfIQX3SIuQZv2t/tKX6cO1IVNvMwYYRDnVbuR7SaJ3XGeBYeM/jPYlxpB2eZ5LHDeinN1/ksmnctFTsznmR4ZfzvnaWCm/jR7fvQ0pkN/v5P5mnq41rL4KwI6C8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590367518935222.95244284912326; Sun, 24 May 2020 17:45:18 -0700 (PDT) Received: from localhost ([::1]:34348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jd1Ez-0001aw-88 for importer@patchew.org; Sun, 24 May 2020 20:45:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcyqx-0004Di-1O for qemu-devel@nongnu.org; Sun, 24 May 2020 18:12:19 -0400 Received: from mail-ej1-x641.google.com ([2a00:1450:4864:20::641]:35373) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jcyqv-0001uJ-Ew for qemu-devel@nongnu.org; Sun, 24 May 2020 18:12:18 -0400 Received: by mail-ej1-x641.google.com with SMTP id s21so18745972ejd.2 for ; Sun, 24 May 2020 15:12:15 -0700 (PDT) Received: from leo-lap.lan ([176.230.212.100]) by smtp.gmail.com with ESMTPSA id o18sm2749808eje.40.2020.05.24.15.12.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 May 2020 15:12:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=P8RrrDncw9cLMOwbVe2eVW0WWaz4iq9FuWQ879jZAg8=; b=NwL2KtqJIefZhbEV3HtWyR2wVJXEbCvNXz8j/k6o67LFo19tvSjx6xIBb6+69HXI8/ X8DtrR9WQzWaayxtOS0A3KekWEE1O6jLJolWqifdcXW/hZxZtYQl4DwtIHNux7swr49i cREGUyEq/voQIiBSp9rtDawJIc9UPxVXKDuo8vISt+twLPxSUBTP27eyOssw63Wlujao Q6UXx8LFL+LBrakGdbcKkQcjZR0szP/EpOGXSdVEgcQtZX0YaS0vUrWmkopY3ZQIdIcb 6XJN0yA+c0nLlRxiyfIepdbkBeTi/FOgs764o/6S36mk0LPk/MSsyQnmIU2UPiyBosRO bjUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=P8RrrDncw9cLMOwbVe2eVW0WWaz4iq9FuWQ879jZAg8=; b=diovlpcdx1xe9yJqw/XMsGrvBxtC6+hIt88kmeOEORPA8ab0V1rnq8N9esmJIjimGi 01l46C1aS25N7FAo3RsEfDbqr0tEYAsUMX62KvrEO9mbvfPzhxY6a3ZAAu24Ovhy70vd YEkOF61s1z/vbAIlDGS7xhLiPuvT69D06lD/mhnzLxaKjmAhNW82dctIl219mjtAvXcO uaUHZDdc86ze92RFw1KaZSVBaUlG2fOpl/c0pSpATEb78usg5N4iyKhJ5owpyXPzAG3/ 6O9qkCUzBeXCRHK2IwRQ3ZIm/pHJl/E+Fxv9sAWqfujxFCKf+z7gOK/vGPm4upFkPKcM XbLw== X-Gm-Message-State: AOAM532Iw7qLr7uNqsaRDydRnR8ufok7yx7Wjxea2AbSByW/EhvrsVHH UhbPFKCiY/GfwaY1OdcD47Iq0/uUJ1QWqg== X-Google-Smtp-Source: ABdhPJwCIsqHxNV/942dEfGYjRXrYhskGeZ/aD+tkG3FUjlXw6mQoR7jrdt9NNAc2VTv0iek2ZESeA== X-Received: by 2002:a17:906:63c9:: with SMTP id u9mr17351196ejk.487.1590358333889; Sun, 24 May 2020 15:12:13 -0700 (PDT) From: Leonid Bloch To: qemu-devel@nongnu.org Subject: [PATCH] configure: Do not ignore malloc value Date: Mon, 25 May 2020 01:12:04 +0300 Message-Id: <20200524221204.9791-1-lb.workbox@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::641; envelope-from=lb.workbox@gmail.com; helo=mail-ej1-x641.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Mailman-Approved-At: Sun, 24 May 2020 20:44:34 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leonid Bloch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Laurent Vivier , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Leonid Bloch Not checking the value of malloc will cause a warning with GCC 10.1, which may result in configuration failure, with the following line in config.log: config-temp/qemu-conf.c:2:18: error: ignoring return value of =E2=80=98mall= oc=E2=80=99 declared with attribute =E2=80=98warn_unused_result=E2=80=99 [-= Werror=3Dunused-result] 2 | int main(void) { malloc(1); return 0; } | ^~~~~~~~~ Signed-off-by: Leonid Bloch --- configure | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 2fc05c4465..d0220b2944 100755 --- a/configure +++ b/configure @@ -4567,7 +4567,13 @@ fi if test "$tcmalloc" =3D "yes" ; then cat > $TMPC << EOF #include -int main(void) { malloc(1); return 0; } +int main(void) { + void *tmp =3D malloc(1); + if (tmp !=3D NULL) { + return 0; + } + return 1; +} EOF =20 if compile_prog "" "-ltcmalloc" ; then @@ -4583,7 +4589,13 @@ fi if test "$jemalloc" =3D "yes" ; then cat > $TMPC << EOF #include -int main(void) { malloc(1); return 0; } +int main(void) { + void *tmp =3D malloc(1); + if (tmp !=3D NULL) { + return 0; + } + return 1; +} EOF =20 if compile_prog "" "-ljemalloc" ; then @@ -6144,7 +6156,9 @@ if test "$sanitizers" =3D "yes" ; then #include int main(void) { void *tmp =3D malloc(10); - return *(int *)(tmp + 2); + if (tmp !=3D NULL) { + return *(int *)(tmp + 2); + } } EOF if compile_prog "$CPU_CFLAGS -Werror -fsanitize=3Dundefined" ""; then --=20 2.26.2