public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "zfigura at codeweavers dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/111669] New: bogus -Wnonnull in conditionally executed code Date: Tue, 03 Oct 2023 04:34:03 +0000 [thread overview] Message-ID: <bug-111669-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111669 Bug ID: 111669 Summary: bogus -Wnonnull in conditionally executed code Product: gcc Version: 13.2.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: zfigura at codeweavers dot com Target Milestone: --- Created attachment 56032 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56032&action=edit reduced testcase, compile with -O2 -Werror=nonnull Sorry about the rather useless title, but I can't really figure out what actually triggers this error. It seems to depend on some arcane combination of optimizations. I was able to reduce this down to a pretty minimal test case, attached here. It may be possible to reduce it further but I couldn't easily find a way. The actual code that triggers this is here [1]. lstrcpyA() and lstrcatA() are trivial wrappers around strcpy/strcat. The NULL comes from get_search_path() at line 192. The offending strcpy/strcat will never be reached if GetWindowsDirectoryA() returns nonzero, which it always should. However, gcc triggers a -Wnonnull warning anyway. Interestingly, the original Wine code only triggers the warning with -march=bdver2 (or other values of -march), but the reduced testcase triggers it with no -march flags. [1] https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/krnl386.exe16/file.c#l639
next reply other threads:[~2023-10-03 4:34 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-10-03 4:34 zfigura at codeweavers dot com [this message] 2023-10-04 1:44 ` [Bug middle-end/111669] " xry111 at gcc dot gnu.org 2023-10-04 1:46 ` xry111 at gcc dot gnu.org 2023-10-04 15:44 ` zfigura at codeweavers dot com 2023-10-05 5:42 ` xry111 at gcc dot gnu.org 2023-10-05 5:48 ` xry111 at gcc dot gnu.org 2023-10-05 6:05 ` zfigura at codeweavers dot com 2023-10-05 6:14 ` xry111 at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-111669-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).