Message ID | 20211031162558.3254777-1-rep.dot.nop@gmail.com |
---|---|
State | Committed |
Commit | a16010a3eed9d5a3e49098351cf5ba18483cdc02 |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 16614385802A for <patchwork@sourceware.org>; Sun, 31 Oct 2021 16:27:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16614385802A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635697622; bh=GMl4F+C0TMH3It7Q9T75+7PYTv4s2h/Fls05KF23eT4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=kSuDoYQheCrxUAAd0z/s8aY5vN3G0JlciMztUw40jzt1E2v58zcwBRRnYHyUJHzlt G7FXlu6ha8XqPnnz+jV6o2jJQ5EAVnJCvTLCqDbg4IuNJUAL1yf69xMbyyKgIUOTbA YBfs4F2CGI9z+tt9e3TxyP/2444jR3Kxgeu0zvyY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id E5DB73858408; Sun, 31 Oct 2021 16:26:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E5DB73858408 Received: by mail-wr1-x42d.google.com with SMTP id r8so11890845wra.7; Sun, 31 Oct 2021 09:26:16 -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=GMl4F+C0TMH3It7Q9T75+7PYTv4s2h/Fls05KF23eT4=; b=xZAXQjdeBuQhOgk9f/HPxiGo6e7csYttARDxKV0hGIJVcM2N2eALmn9EdCDh7glypL uC+6ZmIR7LVCqBClZzcFOsGPzEeM/VcSE5likWM8KxqU74z1zUBqOvXFIF2aOVvi9Hum gWxKoNxyqtZYs6oUPLey+CwF7ZIrGGLny3i3prtqDz+P/lclh/zpnOt+bcqkur7e7b5P x2K2Srzg19xA+mRDHyVMYu7wOldSlyQ1k695XwkYh01W5E6ExTt5WTCKdY2rlxUlnZ+0 sTIhrtZ8TR5eAGySyKxV5pZZHpvBEDoJxSvz4iK2Q4s27QjgAOwPqp6IOVbGqAqRfEU/ JT8g== X-Gm-Message-State: AOAM5312VnkHta9Hu9qPbNSGSXPBD9xN5Vinynl5PK7d9O7g6yNPIYYr GvifZdZlp3vNyRUd3E+RdFw= X-Google-Smtp-Source: ABdhPJz4VdBnD/CHFSz7NYZXiSgEMfjofls9ze4sy94MAubyGxqA0ZpvtLbTv9VaN7Bg0bHwXcHmvw== X-Received: by 2002:a5d:568c:: with SMTP id f12mr20744909wrv.240.1635697575894; Sun, 31 Oct 2021 09:26:15 -0700 (PDT) Received: from nbbrfq.weghof (dynamic-2bq7di4u2lfl4qjka9-pd01.res.v6.highway.a1.net. [2001:871:227:33a8:f6a3:c58c:7641:e771]) by smtp.gmail.com with ESMTPSA id m35sm17429942wms.2.2021.10.31.09.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Oct 2021 09:26:15 -0700 (PDT) Received: from b by nbbrfq.weghof with local (Exim 4.95) (envelope-from <b@localhost>) id 1mhDew-00Deig-SL; Sun, 31 Oct 2021 17:26:14 +0100 To: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Subject: [PATCH] Fortran: Silence -Wmaybe-uninitialized warning Date: Sun, 31 Oct 2021 17:25:58 +0100 Message-Id: <20211031162558.3254777-1-rep.dot.nop@gmail.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Bernhard Reutner-Fischer via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Cc: Bernhard Reutner-Fischer <aldot@gcc.gnu.org> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
Fortran: Silence -Wmaybe-uninitialized warning
|
|
Commit Message
Bernhard Reutner-Fischer
Oct. 31, 2021, 4:25 p.m. UTC
From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
gcc/fortran/ChangeLog:
* resolve.c (resolve_fl_procedure): Initialize
allocatable_or_pointer.
---
fortran/resolve.c: In function 'bool resolve_fl_procedure(gfc_symbol*, int)':
fortran/resolve.c:13391:7: warning: 'allocatable_or_pointer' may be used uninitialized in this function [-Wmaybe-uninitialized]
13390 | if (sym->attr.elemental && sym->result
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13391 | && allocatable_or_pointer)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
.../fortran/resolve.c:13197:8: note: 'allocatable_or_pointer' was declared here
13197 | bool allocatable_or_pointer;
| ^~~~~~~~~~~~~~~~~~~~~~
Bootstrapped and regtested without regressions.
Ok for trunk?
---
gcc/fortran/resolve.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi Bernhard, > gcc/fortran/ChangeLog: > > * resolve.c (resolve_fl_procedure): Initialize > allocatable_or_pointer. Looking at the code, it is clear that this is a false positive, or a false maybe, but the semantics of C/C++ may well indicate that sym->result could change, although it clearly does not. So, OK. Thanks for the patch! Best regards Thomas
On Sun, 31 Oct 2021 18:05:36 +0100 Thomas Koenig <tkoenig@netcologne.de> wrote: > Hi Bernhard, > > > gcc/fortran/ChangeLog: > > > > * resolve.c (resolve_fl_procedure): Initialize > > allocatable_or_pointer. > > Looking at the code, it is clear that this is a false > positive, or a false maybe, but the semantics of C/C++ > may well indicate that sym->result could change, although > it clearly does not. Agree wholeheartedly > > So, OK. pushed as r12-4811 > > Thanks for the patch! I have to thank you for the quick review! cheers,
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 8da396b32ec..21126cba262 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -13179,7 +13179,7 @@ static bool resolve_fl_procedure (gfc_symbol *sym, int mp_flag) { gfc_formal_arglist *arg; - bool allocatable_or_pointer; + bool allocatable_or_pointer = false; if (sym->attr.function && !resolve_fl_var_and_proc (sym, mp_flag))