From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 924AC3858CDB; Thu, 5 Oct 2023 06:14:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 924AC3858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696486477; bh=kV6fna9YN8946xCfFKT6Fc3Wnri2ZQ2mPE2g1nBCq5w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fox4SVxF/6RWczIKRpqaNMFde2y/CsSt2SZrhKt4pnLdcin1W5Xyj9hXh9+J6sJQD a+UvS9nDP+DjGJflRYwHqQS9Y6td6fiNw8+JqUsZyGsW6v5r4gWMFg2ixJmNetqOCW CmtwWP7DO/052mIlCMdVlH3LikETQ85uccz61EYw= 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: Thu, 05 Oct 2023 06:14:37 +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: enhancement 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: bug_severity 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 ---------------------------------------------------------------------------- Severity|normal |enhancement --- Comment #7 from Xi Ruoyao --- (In reply to Zeb Figura from comment #6) > It is my impression that gcc is interested in avoiding false positives for > its warnings. Correct, but we are also interested in avoiding false negatives. Without e= xtra information provided by something like __builtin_unreachable, any change decreasing false positives will increase false negatives (unless the false positive is completely stupid: for the simplified test case I think the fal= se positive not completely stupid, but maybe it is completely stupid for your original program). > It is also my impression that -Wnonnull is not *supposed* to emit warnings > for cases where, from the compiler's point of view, NULL might be passed, > but some high-level invariant prevents this. Compare -Wmaybe-uninitialize= d, > where the documentation clearly specifies otherwise. Maybe we can separate -Wnonnull into -Wmaybe-nonnull and -Wnonnull, or just make -Wnonnull not to emit warnings for conditional paths and tell users expecting a nonnull warning in conditional paths to use the analyzer (it's = very supposed to warn even in conditional paths) instead. > If both of these impressions are incorrect, this bug report can be closed= as > WONTFIX. I'll keep it open but make it an enhancement.=