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/96374] New: Analyzer erroneously rejects certain diagnostics due to path-feasibility being used on shortest path Date: Wed, 29 Jul 2020 15:33:49 +0000 [thread overview] Message-ID: <bug-96374-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96374 Bug ID: 96374 Summary: Analyzer erroneously rejects certain diagnostics due to path-feasibility being used on shortest path Product: gcc Version: 11.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: --- Analyzer fails to find a path to the __analyzer_dump_path call: #include "analyzer-decls.h" int test_6 (int a, int b) { int problem = 0; if (a) problem = 1; if (b) { if (!problem) problem = 2; __analyzer_dump_path (); /* { dg-message "path" "" { xfail *-*-* } } */ } return problem; } It's rejecting the path due to picking the shortest path, and then a bad interaction with feasibility-checking. If feasibility-checking is hacked out, it picks this path (with -fanalyzer-verbosity=3 for clarity): ‘test_6’: events 1-7 | | 6 | if (a) | | ^ | | | | | (1) following ‘false’ branch (when ‘a == 0’)... | 7 | problem = 1; | 8 | if (b) | | ~ | | | | | (2) ...to here | | (3) following ‘true’ branch (when ‘b != 0’)... | 9 | { | 10 | if (!problem) | | ~ | | | | | (4) ...to here | | (5) following ‘false’ branch (when ‘problem != 0’)... | 11 | problem = 2; | 12 | __analyzer_dump_path (); | | ~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (6) ...to here | | (7) here | However, with feasibility-checking, "problem" is still 0 at event (5) (due to the shortest path skipping the "problem = 1" suite), and hance the "problem != 0" edge is invalid, and the edge from (5) to (6) is rejected, and the diagnostic rejected. We want the shortest feasible path if one exists, and are currently approximating this by picking the shortest path, and checking if it's feasible, which isn't the same thing. Am not sure how best to fix this, but need a PR to mark this as XFAIL.
next reply other threads:[~2020-07-29 15:33 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-29 15:33 dmalcolm at gcc dot gnu.org [this message] 2020-07-29 15:42 ` [Bug analyzer/96374] " dmalcolm at gcc dot gnu.org 2021-02-02 2:53 ` cvs-commit at gcc dot gnu.org 2021-02-02 2:55 ` cvs-commit at gcc dot gnu.org 2021-02-26 1:00 ` cvs-commit at gcc dot gnu.org 2021-03-10 17:03 ` cvs-commit at gcc dot gnu.org 2021-03-11 22:44 ` cvs-commit at gcc dot gnu.org 2021-03-11 22:45 ` cvs-commit at gcc dot gnu.org 2021-03-11 22:48 ` cvs-commit at gcc dot gnu.org 2021-03-11 23:16 ` 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-96374-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).