From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by sourceware.org (Postfix) with ESMTPS id 5F3493857C4E for ; Mon, 14 Feb 2022 15:24:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5F3493857C4E Received: by mail-io1-xd31.google.com with SMTP id h7so20267940iof.3 for ; Mon, 14 Feb 2022 07:24:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=jRppX9x287q3azR2RcK7aPWUyz5Fd507pybpxWBfJWo=; b=wgXRdWV2/Esvx8Xtz20BwqY8dS8un+5o9aOubiEvwfK6fSDFNBLyH9u2yXHubGAAw1 mEYzoEY2RrPMbY/qim3SLtxLwcLOWeSso5/007rieovPm6zNYbrScl3dnDSVYeASwPeq di76nnfNKcHCTWbUi9kKy/PgHzvkgq2t4pO2So5GPdzcSE85X0nohDMPxyCXUUiDdKdC rEzRdA2zIqVqWYqhxIDNcMquH8sFt7Y5nhghKOYWhKhTmpI8yhANgIT01nWsEviGSdSK fuiXSDIqU2ssmhQTUmd9bqVtmaP4Ow/NuIQjeat3vZocrIqvOR921fdk39rPUFqrMZOY s1Ag== X-Gm-Message-State: AOAM532JQpmxaPyjnZM6HEdIbfjr9apt3VStO6HSdegI68QVGzhbRNWD ihTAdWqo7cIYZL9BhuBB3PvciGef5iw= X-Google-Smtp-Source: ABdhPJzi2cnBgYtqp2X1mbpJ9qBcJv1wKhMo+gjmulI4N2Hj4LrzjSJQKsrYTmngYJI+LBTboh0Xew== X-Received: by 2002:a5d:8419:: with SMTP id i25mr143170ion.163.1644852276569; Mon, 14 Feb 2022 07:24:36 -0800 (PST) Received: from [192.168.0.41] (97-118-104-1.hlrn.qwest.net. [97.118.104.1]) by smtp.gmail.com with ESMTPSA id f2sm8604757ilu.79.2022.02.14.07.24.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Feb 2022 07:24:36 -0800 (PST) Message-ID: <9dfb6d10-e6a5-f415-b58d-8ac8c6519a5e@gmail.com> Date: Mon, 14 Feb 2022 08:24:35 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: Extended doubt regarding the bug 93432 Content-Language: en-US To: Krishna Narayanan , gcc-help References: <641d2125-7809-77eb-f007-3dd784940873@gmail.com> From: Martin Sebor In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT, KAM_SHORT, NICE_REPLY_A, 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 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: Mon, 14 Feb 2022 15:24:39 -0000 On 2/11/22 11:10, Krishna Narayanan wrote: > Hello, > I tried to run the gcc in the debugger but I am getting a repetitive > error for header files,I tried using -I followed by the path of the > header file (-I/home/krishna/objdir/gcc) in the command but still the > error is persistent. > Error: > In file included from *tree-ssa-uninit.c:22*: > *system.h:209:10*: fatal error: safe-ctype.h: No such file or directory >   209 | #include "safe-ctype.h" >       |          ^~~~~~~~~~~~~~ > compilation terminated. > How do I resolve this?Can you please help me out with this and where did > I go wrong? I usually create a translation unit (a .i file for a C source and a .ii file for a C++ source) by compiling the .c or .C file with the -E option and then start GCC the debugger on that file. For example, with an unoptimized GCC stage1 build with -g3 enabled in /build/gcc-master, I invoke it in GDB like so: $ /build/gcc-master/gcc/xgcc -B /build/gcc-master/gcc tu.i -wrapper gdb,--arg (In Emacs, I use gdb,-i=mi,--arg as the trailing pieces.) This lets me avoid many of the -I command line options that the GCC driver otherwise passes to to th compiler implicitly. Martin > 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. > >>> > >>> > >>> > >> >