public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/115564] New: -Wanalyzer-infinite-loop false negative when there are no source locations
@ 2024-06-20 18:21 dmalcolm at gcc dot gnu.org
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
0 siblings, 2 replies; 3+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-06-20 18:21 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug analyzer/115564] -Wanalyzer-infinite-loop false negative when there are no source locations
2024-06-20 18:21 [Bug analyzer/115564] New: -Wanalyzer-infinite-loop false negative when there are no source locations dmalcolm at gcc dot gnu.org
@ 2024-06-20 21:01 ` dmalcolm at gcc dot gnu.org
2024-06-21 22:34 ` dmalcolm at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-06-20 21:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115564
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2024-06-20
Ever confirmed|0 |1
--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Am testing a fix
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug analyzer/115564] -Wanalyzer-infinite-loop false negative when there are no source locations
2024-06-20 18:21 [Bug analyzer/115564] New: -Wanalyzer-infinite-loop false negative when there are no source locations dmalcolm at gcc dot gnu.org
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
1 sibling, 0 replies; 3+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-06-21 22:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115564
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2024-June/65
| |5424.html
Status|ASSIGNED |WAITING
Keywords| |patch
--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
I've posted a patch for review here:
https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655424.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-21 22:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-20 18:21 [Bug analyzer/115564] New: -Wanalyzer-infinite-loop false negative when there are no source locations dmalcolm at gcc dot gnu.org
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
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).