From patchwork Fri Jun 17 01:55:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1644656 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=I1/ugGJ8; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LPMZz1V1zz9sFk for ; Fri, 17 Jun 2022 11:56:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5B51B383B78D for ; Fri, 17 Jun 2022 01:56:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B51B383B78D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1655430965; bh=rulPR0/vIzweGDuxITZ/YvbXbEtDhlina02P+vzjAUE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=I1/ugGJ86X5awih+F6hzySjNQiS4DzTu1fF8z1NLPe5Mmsfd2x9afVeT38QzRqyCi o/e9RJoZZM4Qt7L5W6A/Xy58VJ6fweRMFjJzesfzao4FAB8xsSkbzSoM+vA4vAQZod sOWbu/0g9Mhx3pu03UOLOY0jfTzOAeyxS2QQtMt0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by sourceware.org (Postfix) with ESMTPS id 3CDBE38560B6 for ; Fri, 17 Jun 2022 01:55:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3CDBE38560B6 Received: by mail-pj1-x1032.google.com with SMTP id k5-20020a17090a404500b001e8875e6242so2948425pjg.5 for ; Thu, 16 Jun 2022 18:55:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rulPR0/vIzweGDuxITZ/YvbXbEtDhlina02P+vzjAUE=; b=y+Q1fE85GyLVsj3FqzMDiF585pPG1n9Tb11B/x+7nfBctEFh1JqfBj5S8gkt6e5e+9 TIf90Q5bgGRHpdQdjlUiHuXiawefrHKLPRTNlrpNGVC+yohwN0dDal5YaYoSvTmrWzG+ jSjSDeUzcFmDuf6xfPAztGfbcSahsUjqz1vL7B/6W1qL9QG21obrQndJANij6vRq1hhe rNpzXXqdbpD27Cgz5ifIpqkR7can/CGHuLd5gngXd9CZ5aGUnS09ztm79ubSAU5KbO3g Iu4nCPO4k60QycCivRED0AVXnNX69mvTNMmSdHFtz9SKyq0Xl9cvsGRQ3JwyTp++eM/r A53Q== X-Gm-Message-State: AJIora8LlD5ikvQyNqM9/s8aap7brVS7ZCn+lp0NNhjMzFQ6rEqC8zIj QgCJ/H5uHEeufMgmrtvl94qp1yxJUtw= X-Google-Smtp-Source: AGRyM1uVF3pm+/8J+gql6JDk/mqrTuh0Ugy3s2uGEKsQI2e2qRHaR1eHmllPqTm/8j0cd7ifNCtvPg== X-Received: by 2002:a17:90a:2f84:b0:1dd:940:50e7 with SMTP id t4-20020a17090a2f8400b001dd094050e7mr18947855pjd.210.1655430947558; Thu, 16 Jun 2022 18:55:47 -0700 (PDT) Received: from gnu-tgl-2.localdomain ([172.58.37.78]) by smtp.gmail.com with ESMTPSA id x5-20020a170902a38500b00168d9630b49sm2233423pla.307.2022.06.16.18.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 18:55:46 -0700 (PDT) Received: from gnu-tgl-2.. (localhost [IPv6:::1]) by gnu-tgl-2.localdomain (Postfix) with ESMTP id 68E5A3005E3; Thu, 16 Jun 2022 18:55:45 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH] elf: Silence GCC 12 false positive warning Date: Thu, 16 Jun 2022 18:55:45 -0700 Message-Id: <20220617015545.1086636-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3027.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "H.J. Lu via Libc-alpha" From: "H.J. Lu" Reply-To: "H.J. Lu" Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Silence GCC 12 false positive warning with -mavx512f on dl-load.c: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106008 $ gcc -O2 -fPIC -march=x86-64 -mavx512f -S -Wall ... dl-load.c: In function ‘_dl_map_object_from_fd.constprop’: dl-load.c:1158:30: warning: ‘(((char *)loadcmds.113_68 + _933 + 16))[329406144173384849].mapend’ may be used uninitialized [-Wmaybe-uninitialized] --- elf/dl-load.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/elf/dl-load.c b/elf/dl-load.c index 2e4a010fc5..95c37dd7ea 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1152,11 +1152,21 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, p_align_max = ph->p_align; c->mapoff = ALIGN_DOWN (ph->p_offset, GLRO(dl_pagesize)); + DIAG_PUSH_NEEDS_COMMENT; + +#if __GNUC_PREREQ (12, 0) + /* Suppress valid GCC warning: + ‘(((char *)loadcmds.113_68 + _933 + 16))[329406144173384849].mapend’ may be used uninitialized [-Wmaybe-uninitialized] + */ + DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized"); +#endif /* Determine whether there is a gap between the last segment and this one. */ if (nloadcmds > 1 && c[-1].mapend != c->mapstart) has_holes = true; + DIAG_POP_NEEDS_COMMENT; + /* Optimize a common case. */ #if (PF_R | PF_W | PF_X) == 7 && (PROT_READ | PROT_WRITE | PROT_EXEC) == 7 c->prot = (PF_TO_PROT