aboutsummaryrefslogtreecommitdiff
path: root/gcc/alias.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2019-12-20 10:56:28 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2020-01-14 20:44:33 -0500
commit8397af8ed0db685312e44117fd52316b57c2c129 (patch)
treebc5012254244c350b835ad1e32593ff126bbb1c6 /gcc/alias.c
parent03dc3f26231cbf5733330028e14706f8ad77fd5a (diff)
downloadgcc-8397af8ed0db685312e44117fd52316b57c2c129.zip
gcc-8397af8ed0db685312e44117fd52316b57c2c129.tar.gz
gcc-8397af8ed0db685312e44117fd52316b57c2c129.tar.bz2
analyzer: fix tests for UNKNOWN_LOCATION
In the reproducer for PR analyzer/58237 I noticed that some events were missing locations (and text); for example event 3 here: | 15 | while (fgets(buf, 10, fp) != NULL) | | ~ | | | | | (2) following 'false' branch... | 'f1': event 3 | |cc1: | 'f1': event 4 | |<source>:19:1: | 19 | } | | ^ | | | | | (4) 'fp' leaks here; was opened at (1) | The root cause is that various places in the analyzer compare locations against UNKNOWN_LOCATION, which fails to detect an unknown location for the case where an unknown_location has been wrapped into an ad-hoc location to record a block. This patch fixes the issue by using get_pure_location whenever testing against UNKNOWN_LOCATION to look through ad-hoc wrappers. For the case above, it thus picks a better location in supernode::get_start_location for event (3) above, improving it to: | 15 | while (fgets(buf, 10, fp) != NULL) | | ~ | | | | | (2) following 'false' branch... |...... | 19 | } | | ~ | | | | | (3) ...to here | | (4) 'fp' leaks here; was opened at (1) | gcc/analyzer/ChangeLog: PR analyzer/58237 * engine.cc (leak_stmt_finder::find_stmt): Use get_pure_location when comparing against UNKNOWN_LOCATION. (stmt_requires_new_enode_p): Likewise. (exploded_graph::dump_exploded_nodes): Likewise. * supergraph.cc (supernode::get_start_location): Likewise. (supernode::get_end_location): Likewise. gcc/testsuite/ChangeLog: PR analyzer/58237 * gcc.dg/analyzer/file-paths-1.c: New test.
Diffstat (limited to 'gcc/alias.c')
0 files changed, 0 insertions, 0 deletions