public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/115564] New: -Wanalyzer-infinite-loop false negative when there are no source locations Date: Thu, 20 Jun 2024 18:21:25 +0000 [thread overview] Message-ID: <bug-115564-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115564 Bug ID: 115564 Summary: -Wanalyzer-infinite-loop false negative when there are no source locations Product: gcc Version: unknown Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Target Milestone: --- Consider e.g.: void test (unsigned b) { for (unsigned i = b; i >= 0; --i) { } } -Wanalyzer-infinite-loop warns about this at -O1 and below: https://godbolt.org/z/axze96331 but at -O2 and above we don't warn. https://godbolt.org/z/xjGMnP3P5 The warning is rejected at: if (inf_loop->m_loc == UNKNOWN_LOCATION) { if (get_logger ()) get_logger ()->log ("no location available for reporting infinite loop"); continue; } We have two basic blocks no statements, and location_t == UNKNOWN_LOCATION on each of the edges connecting them. Ideas for fixing: * backtrack through the egraph to find the first useful location_t on a path to the entry to the infinite loop * ensure that location_t values are set on the CFG edges
next reply other threads:[~2024-06-20 18:21 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-06-20 18:21 dmalcolm at gcc dot gnu.org [this message] 2024-06-20 21:01 ` [Bug analyzer/115564] " dmalcolm at gcc dot gnu.org 2024-06-21 22:34 ` dmalcolm 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-115564-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).