public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/108524] New: -Wanalyzer-infinite-recursion false positives seen in qemu's JSON parser
@ 2023-01-24 17:27 dmalcolm at gcc dot gnu.org
2023-01-25 17:25 ` [Bug analyzer/108524] " dmalcolm at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2023-01-24 17:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108524
Bug ID: 108524
Summary: -Wanalyzer-infinite-recursion false positives seen in
qemu's JSON parser
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: dmalcolm at gcc dot gnu.org
Target Milestone: ---
Created attachment 54338
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54338&action=edit
Reproducer
Attached reproducer reports 4 warnings from GCC 13's new
-Wanalyzer-infinite-recursion on qemu's JSON parser.
All of them seem to be false positives, in that tokens are being consumed
during the recursion:
https://godbolt.org/z/KWbPTcMEd
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug analyzer/108524] -Wanalyzer-infinite-recursion false positives seen in qemu's JSON parser
2023-01-24 17:27 [Bug analyzer/108524] New: -Wanalyzer-infinite-recursion false positives seen in qemu's JSON parser dmalcolm at gcc dot gnu.org
@ 2023-01-25 17:25 ` dmalcolm at gcc dot gnu.org
2023-01-26 14:13 ` cvs-commit at gcc dot gnu.org
2023-01-26 14:23 ` dmalcolm at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2023-01-25 17:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108524
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Last reconfirmed| |2023-01-25
--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
I'm testing a fix for this.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug analyzer/108524] -Wanalyzer-infinite-recursion false positives seen in qemu's JSON parser
2023-01-24 17:27 [Bug analyzer/108524] New: -Wanalyzer-infinite-recursion false positives seen in qemu's JSON parser dmalcolm at gcc dot gnu.org
2023-01-25 17:25 ` [Bug analyzer/108524] " dmalcolm at gcc dot gnu.org
@ 2023-01-26 14:13 ` cvs-commit at gcc dot gnu.org
2023-01-26 14:23 ` dmalcolm at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-26 14:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108524
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:
https://gcc.gnu.org/g:7bffea89f1f164efc10dd37d979a83c4c5fbfa7e
commit r13-5388-g7bffea89f1f164efc10dd37d979a83c4c5fbfa7e
Author: David Malcolm <dmalcolm@redhat.com>
Date: Thu Jan 26 09:12:21 2023 -0500
analyzer: fix false positives from -Wanalyzer-infinite-recursion [PR108524]
Reject -Wanalyzer-infinite-recursion diagnostics in which control flow
has been affected by conjured_svalues between the initial call to a
function and the subsequent entry to that function. This prevents false
positives such as in qemu's recursive JSON parser where function calls are
changing state in the rest of the program (e.g. consuming tokens), despite
the modelled state being effectively identical at both nested entrypoints.
gcc/analyzer/ChangeLog:
PR analyzer/108524
* analyzer.h (class feasible_node): New forward decl.
* diagnostic-manager.cc (epath_finder::get_best_epath): Add "pd"
param.
(epath_finder::explore_feasible_paths): Likewise.
(epath_finder::process_worklist_item): Likewise. Use it to call
pending_diagnostic::check_valid_fpath_p on the final fpath to
give pending_diagnostic a way to add additional restrictions on
feasibility.
(saved_diagnostic::calc_best_epath): Pass pending_diagnostic to
epath_finder::get_best_epath.
* infinite-recursion.cc: Include "analyzer/feasible-graph.h".
(infinite_recursion_diagnostic::check_valid_fpath_p): New.
(infinite_recursion_diagnostic::fedge_uses_conjured_svalue_p): New.
(infinite_recursion_diagnostic::expr_uses_conjured_svalue_p): New.
* pending-diagnostic.h (pending_diagnostic::check_valid_fpath_p):
New vfunc.
gcc/testsuite/ChangeLog:
PR analyzer/108524
* gcc.dg/analyzer/infinite-recursion-pr108524-1.c: New test.
* gcc.dg/analyzer/infinite-recursion-pr108524-2.c: New test.
*
gcc.dg/analyzer/infinite-recursion-pr108524-qobject-json-parser.c:
New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug analyzer/108524] -Wanalyzer-infinite-recursion false positives seen in qemu's JSON parser
2023-01-24 17:27 [Bug analyzer/108524] New: -Wanalyzer-infinite-recursion false positives seen in qemu's JSON parser dmalcolm at gcc dot gnu.org
2023-01-25 17:25 ` [Bug analyzer/108524] " dmalcolm at gcc dot gnu.org
2023-01-26 14:13 ` cvs-commit at gcc dot gnu.org
@ 2023-01-26 14:23 ` dmalcolm at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2023-01-26 14:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108524
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Should be fixed by the above commit.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-26 14:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24 17:27 [Bug analyzer/108524] New: -Wanalyzer-infinite-recursion false positives seen in qemu's JSON parser dmalcolm at gcc dot gnu.org
2023-01-25 17:25 ` [Bug analyzer/108524] " dmalcolm at gcc dot gnu.org
2023-01-26 14:13 ` cvs-commit at gcc dot gnu.org
2023-01-26 14:23 ` 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).