From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id 8EA4D3858D20 for ; Wed, 9 Feb 2022 05:06:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8EA4D3858D20 Received: by mail-pl1-x629.google.com with SMTP id k17so1283399plk.0 for ; Tue, 08 Feb 2022 21:06:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=DFyWojz3LxuuSQnPmLelEuooc1zpJHm0MbjvSveL5TI=; b=jD90bhh8OdjqqbrbXDYaxfuQX8ErvprfTNRCZQXMUR8AegSL64bRM8cw0X8Y+Jk8L4 t6kV96+/V8+z2gKtDY7qkOa0TKEr5sZTkk4TCvIZvl+prT6SM4r8vudTjGRUjEEVy9IB EAPpI6AYfdOVKGZ/sNpDqaHRwaa4sMLYPrC5rSzwEyZYGrBZ80XAcFDL3ZfR2xMf9KVH njwUhjr8/BEilZFHQP1nedi5dvI3yloBHtjwTVqmSWEGyGgema1SXno3W8TXO/aYEhp8 NPtGBQfcYjw7FmEqE+d/4mOWIC/nxekLP6c+fsRKPnWUi3muEARYuRj6K1OOL4ida4aa dR+w== X-Gm-Message-State: AOAM531FjzhsdNfcZJBNGzgs77ysINzDsP3sAJFdmvfmI8aN5aawn76A NoE+VUII7tOnewOSoKix8wrknFC98Hc1qMWjBELwGuOloH8= X-Google-Smtp-Source: ABdhPJzsvVxLwn8LtOW45HOXBAzGYU7aomrot7cctbCMn5Gwo7/TbFbQ2gIeILWIbXXcpMXBw30/MUSK6h8WitLR1kU= X-Received: by 2002:a17:90a:df04:: with SMTP id gp4mr666972pjb.15.1644383193323; Tue, 08 Feb 2022 21:06:33 -0800 (PST) MIME-Version: 1.0 References: <641d2125-7809-77eb-f007-3dd784940873@gmail.com> In-Reply-To: <641d2125-7809-77eb-f007-3dd784940873@gmail.com> From: Krishna Narayanan Date: Wed, 9 Feb 2022 10:36:21 +0530 Message-ID: Subject: Re: Extended doubt regarding the bug 93432 To: Martin Sebor , gcc-help , Jonathan Wakely X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Feb 2022 05:06:37 -0000 Yes Sir, I will go through the dump from uninit pass with required optimizations.I will try the tree-ssa-uninit.cc on gdb. Thanks and Regards, Krishna Narayanan. On Wed, Feb 9, 2022 at 3:20 AM Martin Sebor wrote: > On 2/8/22 10:37, Jonathan Wakely via Gcc-help wrote: > > On Tue, 8 Feb 2022 at 17:18, Krishna Narayanan < > > krishnanarayanan132002@gmail.com> wrote: > > > >> Thanks for your response,Could you please clarify if this is a bug? > >> > > > > It warns with -O1, which is the documented behaviour: > > > > The effectiveness of some warnings depends on optimizations also > > being enabled. For example -Wsuggest-final-types is more > > effective with link-time optimization and -Wmaybe-uninitialized > does > > not warn at all unless optimization is enabled. > > Yes, although the latter sentence is no longer completely accurate. > Since GCC 11 -Wmaybe-uninitialized doesn't need optimization to trigger > for code that passes an uninitialized object to a function that takes > a const reference. Let me update the manual with that. > > > So no, I don't think it' a bug. GCC is behaving as designed. Ideally it > > would be better at warning without optimization, but changing that would > be > > hard. > > It might be tricky to handle this case without causing false positives > in others. > > Krishna, to understand why some of these cases are diagnosed and others > aren't, you need to look at either the dump from the uninit pass > (-fdump-tree-uninit) with -O1 and above, or at some early dump (e.g., > -fdump-tree-ssa) at -O0. Here's a link to the former on Godbolt for > your example: > > https://gcc.godbolt.org/z/89c4s7o6E > > The best way is of course to step through GCC in a debugger (for > the uninitialized warnings the code is in gcc/tree-ssa-uninit.cc). > > Martin > > > > > > > > > > > > >> Regards, > >> Krishna Narayanan. > >> > >> On Tue, Feb 8, 2022 at 10:28 PM Jonathan Wakely > >> wrote: > >> > >>> > >>> > >>> On Tue, 8 Feb 2022 at 16:25, Krishna Narayanan via Gcc-help < > >>> gcc-help@gcc.gnu.org> wrote: > >>> > >>>> Hello, > >>>> As an extension to the bug 93432 > >>>> (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93432), I would like to > >>>> add a few more points,here in the given code > >>>> (https://godbolt.org/z/sYjqjqh3d) there is a warning averted but > there > >>>> is no warning shown for this code > >>>> (https://gcc.godbolt.org/z/oo5sf4oec) . > >>>> I tried it with "-fno-strict-aliasing -fwrapv > >>>> -fno-aggressive-loop-optimizations" and "fsanitize=undefined".There > >>>> are no errors for gcc but clang has runtime errors,the error for > >>>> clang: https://gcc.godbolt.org/z/1hq8x1o8E . > >>>> > >>>> Can we have a warning in the second case as well? It will be much more > >>>> convenient as there is a lapse of initialization. > >>>> > >>> > >>> Yes, ideally it would warn. > >>> > >>> > >>> > >> > >