From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2433C3858028; Mon, 1 Aug 2022 22:01:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2433C3858028 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/98109] Seemingly wrong warnings from -Wnonnull when combined with -O2 -fsanitize=undefined Date: Mon, 01 Aug 2022 22:01:50 +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: 11.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: NEW 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: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2022 22:01:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98109 --- Comment #5 from Martin Sebor --- (In reply to Bernd Buschinski from comment #4) > Can someone tell me if this should be a new bug or is just a duplicate? It's the same bug. The sanitizer transforms the source code into the follo= wing IR (note the 0B argument to my_memmem): [local count: 390331996]: if (str_path$buffer_7 =3D=3D 0B) goto ; [0.00%] else goto ; [100.00%] [count: 0]: __builtin___ubsan_handle_nonnull_arg (&*.Lubsan_data2); _12 =3D my_memmem (0B, str_path$length_11, ".abcd", 5); <<< warning here if (_12 !=3D 0B) goto ; [54.59%] else goto ; [45.41%]=