From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 159C93858433; Wed, 4 Oct 2023 01:44:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 159C93858433 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696383885; bh=kvPMpLeS38wImCMcaNDfMnZWy67Y3bQWHfVycU38qMw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sSy/Bk5xvSkyEWfeFCYj+LTRtf5nl5w4GLJ00tww+4D3GSlLk65gGH6MHufr1+c0g nOENnfsHrzjlwlzRvtFlGjVZpwOmT6BlFf0WnRLZG4z/dI48WtNWoVSisimdRCO6RD x3LcnnhWm6JAnn/jZnKCs2QbaIPAEoJi3N1j1dRo= From: "xry111 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/111669] bogus -Wnonnull in conditionally executed code Date: Wed, 04 Oct 2023 01:44:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: xry111 at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111669 Xi Ruoyao changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xry111 at gcc dot gnu.org --- Comment #1 from Xi Ruoyao --- The warning given for the reduced test case is correct because it does not = make sense. It should be just rewritten as int GetSystemDirectory16(char *path, int count) { if (GetWindowsDirectoryA()) __builtin_unreachable(); return 0; } because in the case if GetWindowsDirectoryA() returns non-zero, the code al= ways invoke undefined behavior. I'm not sure about the original file.c, but AFAIK GCC developers are keepin= g to say "hey, don't use -Werror".=