diff options
author | David Malcolm <dmalcolm@redhat.com> | 2020-02-04 16:23:27 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-02-05 09:49:26 -0500 |
commit | a4d3bfc0851ac1b489c4dea5b57dcc08adb20457 (patch) | |
tree | 14f711db4f537bd3f7ffef85afca7e235ac3a5e4 /gcc/testsuite | |
parent | b7b3378f91c0641f2ef4d88db22af62a571c9359 (diff) | |
download | gcc-a4d3bfc0851ac1b489c4dea5b57dcc08adb20457.zip gcc-a4d3bfc0851ac1b489c4dea5b57dcc08adb20457.tar.gz gcc-a4d3bfc0851ac1b489c4dea5b57dcc08adb20457.tar.bz2 |
analyzer: add enode status and revamp __analyzer_dump_exploded_nodes
The analyzer recognizes __analyzer_dump_exploded_nodes as a "magic"
function for use in DejaGnu tests: at the end of the pass, it issues
a warning at each such call, dumping the count of exploded nodes seen at
the call, which can be checked in test cases via dg-warning directives,
along with the IDs of the enodes (which is helpful when debugging).
My intent was to give a way of testing the results of the state-merging
code.
The state-merging code can generate duplicate exploded nodes at a point
when state merging occurs, taking a pair of enodes from the worklist
that share a program_point and sufficiently similar state. For these
cases it generates a merged state, and adds edges from those enodes to
the merged-state enode (potentially a new or a pre-existing enode); the
input enodes don't have process_node called on them.
This means that at a CFG join point there can be an unpredictable number
of enodes that we don't care about, where the precise number depends on
the details of the state-merger code, immediately followed by a more
predictable number that we do care about.
I've been papering over this in the analyzer DejaGnu tests somewhat
by adding pairs of __analyzer_dump_exploded_nodes calls at CFG join
points, where the output at the first call is somewhat arbitrary, and
the second has the number we care about; the first number tends to
change "at random" as I tweak the state merging code, in ways that
aren't interesting, but require the tests to be updated.
See e.g. gcc.dg/analyzer/paths-6.c which had:
__analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */
// FIXME: the above can vary between 2 and 3 exploded nodes
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */
This patch remedies this situation by tracking which enodes are
processed, and which are merely "merger" enodes. It updates the
output for __analyzer_dump_exploded_nodes so that count of enodes
only includes the *processed* enodes, and that the IDs are split
into "processed" and "merger" enodes.
The patch simplifies the testsuite by eliminating the redundant calls
described above; the example above becomes:
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
where the output in question is now:
warning: 1 processed enode: [EN: 94] merger(s): [EN: 93]
The patch also adds various checks on the status of enodes, to ensure
e.g. that each enode is processed at most once.
gcc/analyzer/ChangeLog:
* engine.cc (exploded_node::dump_dot): Show merger enodes.
(worklist::add_node): Assert that the node's m_status is
STATUS_WORKLIST.
(exploded_graph::process_worklist): Likewise for nodes from the
worklist. Set status of merged nodes to STATUS_MERGER.
(exploded_graph::process_node): Set status of node to
STATUS_PROCESSED.
(exploded_graph::dump_exploded_nodes): Rework handling of
"__analyzer_dump_exploded_nodes", splitting enodes by status into
"processed" and "merger", showing the count of just the processed
enodes at the call, rather than the count of all enodes.
* exploded-graph.h (exploded_node::status): New enum.
(exploded_node::exploded_node): Initialize m_status to
STATUS_WORKLIST.
(exploded_node::get_status): New getter.
(exploded_node::set_status): New setter.
(exploded_node::m_status): New field.
gcc/ChangeLog:
* doc/analyzer.texi
(Special Functions for Debugging the Analyzer): Update description
of __analyzer_dump_exploded_nodes.
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/data-model-1.c: Update for changed output to
__analyzer_dump_exploded_nodes, dropping redundant call at merger.
* gcc.dg/analyzer/data-model-7.c: Likewise.
* gcc.dg/analyzer/loop-2.c: Update for changed output format.
* gcc.dg/analyzer/loop-2a.c: Likewise.
* gcc.dg/analyzer/loop-4.c: Likewise.
* gcc.dg/analyzer/loop.c: Likewise.
* gcc.dg/analyzer/malloc-paths-10.c: Likewise; drop redundant
call at merger.
* gcc.dg/analyzer/malloc-vs-local-1a.c: Likewise.
* gcc.dg/analyzer/malloc-vs-local-1b.c: Likewise.
* gcc.dg/analyzer/malloc-vs-local-2.c: Likewise.
* gcc.dg/analyzer/malloc-vs-local-3.c: Likewise.
* gcc.dg/analyzer/paths-1.c: Likewise.
* gcc.dg/analyzer/paths-1a.c: Likewise.
* gcc.dg/analyzer/paths-2.c: Likewise.
* gcc.dg/analyzer/paths-3.c: Likewise.
* gcc.dg/analyzer/paths-4.c: Update for changed output format.
* gcc.dg/analyzer/paths-5.c: Likewise.
* gcc.dg/analyzer/paths-6.c: Likewise; drop redundant calls
at merger.
* gcc.dg/analyzer/paths-7.c: Likewise.
* gcc.dg/analyzer/torture/conditionals-2.c: Update for changed
output format.
* gcc.dg/analyzer/zlib-1.c: Likewise; drop redundant calls.
* gcc.dg/analyzer/zlib-5.c: Update for changed output format.
Diffstat (limited to 'gcc/testsuite')
23 files changed, 126 insertions, 127 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ff47b94..f6291df 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,32 @@ +2020-02-05 David Malcolm <dmalcolm@redhat.com> + + * gcc.dg/analyzer/data-model-1.c: Update for changed output to + __analyzer_dump_exploded_nodes, dropping redundant call at merger. + * gcc.dg/analyzer/data-model-7.c: Likewise. + * gcc.dg/analyzer/loop-2.c: Update for changed output format. + * gcc.dg/analyzer/loop-2a.c: Likewise. + * gcc.dg/analyzer/loop-4.c: Likewise. + * gcc.dg/analyzer/loop.c: Likewise. + * gcc.dg/analyzer/malloc-paths-10.c: Likewise; drop redundant + call at merger. + * gcc.dg/analyzer/malloc-vs-local-1a.c: Likewise. + * gcc.dg/analyzer/malloc-vs-local-1b.c: Likewise. + * gcc.dg/analyzer/malloc-vs-local-2.c: Likewise. + * gcc.dg/analyzer/malloc-vs-local-3.c: Likewise. + * gcc.dg/analyzer/paths-1.c: Likewise. + * gcc.dg/analyzer/paths-1a.c: Likewise. + * gcc.dg/analyzer/paths-2.c: Likewise. + * gcc.dg/analyzer/paths-3.c: Likewise. + * gcc.dg/analyzer/paths-4.c: Update for changed output format. + * gcc.dg/analyzer/paths-5.c: Likewise. + * gcc.dg/analyzer/paths-6.c: Likewise; drop redundant calls + at merger. + * gcc.dg/analyzer/paths-7.c: Likewise. + * gcc.dg/analyzer/torture/conditionals-2.c: Update for changed + output format. + * gcc.dg/analyzer/zlib-1.c: Likewise; drop redundant calls. + * gcc.dg/analyzer/zlib-5.c: Update for changed output format. + 2020-02-05 Jakub Jelinek <jakub@redhat.com> PR target/92190 diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c index d75b9fa..e2bd1f9 100644 --- a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c @@ -895,8 +895,7 @@ int test_40 (int flag) i = 17; /* With state-merging, we lose the relationship between 'flag' and 'i'. */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ if (flag) __analyzer_eval (i == 43); /* { dg-warning "UNKNOWN" } */ diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-7.c b/gcc/testsuite/gcc.dg/analyzer/data-model-7.c index 67a681b..cb0b33e 100644 --- a/gcc/testsuite/gcc.dg/analyzer/data-model-7.c +++ b/gcc/testsuite/gcc.dg/analyzer/data-model-7.c @@ -10,8 +10,7 @@ int test_40 (int flag) i = 17; /* Without state-merging, we retain the relationship between 'flag' and 'i'. */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ if (flag) __analyzer_eval (i == 43); /* { dg-warning "TRUE" } */ diff --git a/gcc/testsuite/gcc.dg/analyzer/loop-2.c b/gcc/testsuite/gcc.dg/analyzer/loop-2.c index 20728cb..f106722 100644 --- a/gcc/testsuite/gcc.dg/analyzer/loop-2.c +++ b/gcc/testsuite/gcc.dg/analyzer/loop-2.c @@ -10,14 +10,14 @@ void test(void) { struct s s; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ for (s.i=0; s.i<256; s.i++) { __analyzer_eval (s.i < 256); /* { dg-warning "TRUE" } */ /* (should report TRUE twice). */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ //__analyzer_eval (s.i == 0); /* { d-todo-g-warning "UNKNOWN" "" { xfail *-*-* } } */ /* { d-todo-g-warning "TRUE" "" { target *-*-* } .-1 } */ @@ -33,5 +33,5 @@ void test(void) /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */ /* TODO(xfail^^^): ideally it should figure out i == 256 at exit. */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ } diff --git a/gcc/testsuite/gcc.dg/analyzer/loop-2a.c b/gcc/testsuite/gcc.dg/analyzer/loop-2a.c index 0b1de20..a392ffc 100644 --- a/gcc/testsuite/gcc.dg/analyzer/loop-2a.c +++ b/gcc/testsuite/gcc.dg/analyzer/loop-2a.c @@ -10,7 +10,7 @@ void test(void) { union u u; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ for (u.i=0; u.i<256; u.i++) { @@ -19,7 +19,7 @@ void test(void) /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-2 } */ /* (should report TRUE twice). */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ //__analyzer_eval (u.i == 0); /* { d-todo-g-warning "UNKNOWN" "" { xfail *-*-* } } */ /* { d-todo-g-warning "TRUE" "" { target *-*-* } .-1 } */ @@ -36,5 +36,5 @@ void test(void) /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */ /* TODO(xfail^^^): ideally it should figure out i == 256 at exit. */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ } diff --git a/gcc/testsuite/gcc.dg/analyzer/loop-4.c b/gcc/testsuite/gcc.dg/analyzer/loop-4.c index 2ea44f5..e5767de 100644 --- a/gcc/testsuite/gcc.dg/analyzer/loop-4.c +++ b/gcc/testsuite/gcc.dg/analyzer/loop-4.c @@ -9,7 +9,7 @@ void test(void) { int i, j, k; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ for (i=0; i<256; i++) { @@ -25,7 +25,7 @@ void test(void) __analyzer_eval (j < 256); /* { dg-warning "TRUE" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */ for (k=0; k<256; k++) { @@ -34,10 +34,10 @@ void test(void) __analyzer_eval (k < 256); /* { dg-warning "TRUE" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "4 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "4 processed enodes" } */ } } } - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ } diff --git a/gcc/testsuite/gcc.dg/analyzer/loop.c b/gcc/testsuite/gcc.dg/analyzer/loop.c index 0fcc393..37b757b 100644 --- a/gcc/testsuite/gcc.dg/analyzer/loop.c +++ b/gcc/testsuite/gcc.dg/analyzer/loop.c @@ -6,7 +6,7 @@ void test(void) { int i; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ for (i=0; i<256; i++) { __analyzer_eval (i < 256); /* { dg-warning "TRUE" } */ @@ -22,7 +22,7 @@ void test(void) /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-2 } */ /* TODO(xfail^^^): ideally we ought to figure out i >= 0 for all iterations. */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ } __analyzer_eval (i >= 256); /* { dg-warning "TRUE" } */ @@ -31,5 +31,5 @@ void test(void) /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */ /* TODO(xfail^^^): it only figures out i >= 256, rather than i == 256. */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ } diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-10.c b/gcc/testsuite/gcc.dg/analyzer/malloc-paths-10.c index 2a2937e..ef88388 100644 --- a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-10.c +++ b/gcc/testsuite/gcc.dg/analyzer/malloc-paths-10.c @@ -10,8 +10,7 @@ int test (int flag) other_flag = 0; /* With state-merging, we lose the relationship between 'flag' and 'other_flag'. */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ if (other_flag) __analyzer_eval (flag); /* { dg-warning "UNKNOWN" } */ diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1a.c b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1a.c index 72360c2..d47dfa8 100644 --- a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1a.c +++ b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1a.c @@ -44,14 +44,13 @@ int test_repeated_predicate_1 (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ result = do_stuff (ptr, n); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */ // FIXME: why 3 here? - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */ // FIXME: why 3 here? if (n > 10) @@ -73,11 +72,11 @@ int test_repeated_predicate_2 (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ result = do_stuff_2 (ptr, n); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ if (n > 10) free (ptr); /* { dg-bogus "not on the heap" } */ @@ -102,11 +101,11 @@ int test_explicit_flag (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ result = do_stuff (ptr, n); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */ // FIXME: why 3 here? if (need_to_free) @@ -128,11 +127,11 @@ int test_pointer_comparison (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ result = do_stuff (ptr, n); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */ // FIXME: why 3 here? if (ptr != buf) @@ -159,19 +158,18 @@ int test_initial_flag (int n) /* Due to state-merging, we lose the relationship between 'n > 10' and 'on_heap' here; we have to rely on feasibility-checking in the diagnostic_manager to reject the false warnings. */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ if (on_heap) ptr = (int *)malloc (sizeof (int) * n); else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ result = do_stuff (ptr, n); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "5 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "5 processed enodes" } */ // FIXME: why 5 here? if (n > 10) diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1b.c b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1b.c index 1997bb7..a30b8c0 100644 --- a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1b.c +++ b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1b.c @@ -44,13 +44,11 @@ int test_repeated_predicate_1 (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ result = do_stuff (ptr, n); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ if (n > 10) free (ptr); /* { dg-bogus "not on the heap" } */ @@ -71,11 +69,11 @@ int test_repeated_predicate_2 (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ result = do_stuff_2 (ptr, n); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ if (n > 10) free (ptr); /* { dg-bogus "not on the heap" } */ @@ -100,11 +98,11 @@ int test_explicit_flag (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ result = do_stuff (ptr, n); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ if (need_to_free) free (ptr); /* { dg-bogus "not on the heap" } */ @@ -125,11 +123,11 @@ int test_pointer_comparison (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ result = do_stuff (ptr, n); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ if (ptr != buf) free (ptr); /* { dg-bogus "not on the heap" } */ @@ -155,19 +153,18 @@ int test_initial_flag (int n) /* Due to state-merging, we lose the relationship between 'n > 10' and 'on_heap' here; we have to rely on feasibility-checking in the diagnostic_manager to reject the false warnings. */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ if (on_heap) ptr = (int *)malloc (sizeof (int) * n); else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ result = do_stuff (ptr, n); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ if (n > 10) free (ptr); /* { dg-bogus "not on the heap" } */ diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-2.c b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-2.c index 74d9687..89bd511 100644 --- a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-2.c +++ b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-2.c @@ -24,8 +24,7 @@ int test_repeated_predicate_1 (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ { int *p = ptr; @@ -38,8 +37,7 @@ int test_repeated_predicate_1 (int n) result = sum; } - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */ if (n > 10) free (ptr); /* { dg-bogus "not on the heap" } */ @@ -60,8 +58,7 @@ int test_repeated_predicate_1a (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ { int *p = ptr; @@ -72,8 +69,7 @@ int test_repeated_predicate_1a (int n) result = sum; } - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */ if (n > 10) free (ptr); /* { dg-bogus "not on the heap" } */ @@ -94,11 +90,11 @@ int test_repeated_predicate_2 (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ result = do_stuff_2 (ptr, n); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ if (n > 10) free (ptr); /* { dg-bogus "not on the heap" } */ @@ -123,7 +119,7 @@ int test_explicit_flag (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ { int *p = ptr; @@ -136,7 +132,7 @@ int test_explicit_flag (int n) result = sum; } - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */ if (need_to_free) free (ptr); /* { dg-bogus "not on the heap" } */ @@ -157,7 +153,7 @@ int test_pointer_comparison (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ { int *p = ptr; @@ -170,7 +166,7 @@ int test_pointer_comparison (int n) result = sum; } - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */ if (ptr != buf) free (ptr); /* { dg-bogus "not on the heap" } */ diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-3.c b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-3.c index fe9b240..d20a275 100644 --- a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-3.c +++ b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-3.c @@ -23,8 +23,7 @@ int test_1 (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ { int *p = ptr; @@ -37,7 +36,7 @@ int test_1 (int n) result = sum; } - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */ return result; /* { dg-message "leak of 'p'" } */ /* FIXME: should this be 'ptr'? */ @@ -56,11 +55,11 @@ int test_2 (int n) else ptr = buf; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ result = do_stuff_2 (ptr, n); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ return result; /* { dg-message "leak of 'ptr'" } */ } diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-1.c b/gcc/testsuite/gcc.dg/analyzer/paths-1.c index 0646877..df5b3a6 100644 --- a/gcc/testsuite/gcc.dg/analyzer/paths-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/paths-1.c @@ -13,6 +13,5 @@ void test (struct foo *pf) bar (0); else bar (1); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ } diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-1a.c b/gcc/testsuite/gcc.dg/analyzer/paths-1a.c index 8760de9..a1b842f 100644 --- a/gcc/testsuite/gcc.dg/analyzer/paths-1a.c +++ b/gcc/testsuite/gcc.dg/analyzer/paths-1a.c @@ -13,6 +13,5 @@ void test (union foo *pf) bar (0); else bar (1); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ } diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-2.c b/gcc/testsuite/gcc.dg/analyzer/paths-2.c index c48a2d7..3efc053 100644 --- a/gcc/testsuite/gcc.dg/analyzer/paths-2.c +++ b/gcc/testsuite/gcc.dg/analyzer/paths-2.c @@ -6,9 +6,7 @@ int test (int a) return (-2); } - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ - - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ return 0; } @@ -19,9 +17,7 @@ int test_2 (int a) return (-2); } - __analyzer_dump_exploded_nodes (0); /* { dg-warning "4 exploded nodes" } */ - - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ return 0; } diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-3.c b/gcc/testsuite/gcc.dg/analyzer/paths-3.c index 440213b..9bd3030 100644 --- a/gcc/testsuite/gcc.dg/analyzer/paths-3.c +++ b/gcc/testsuite/gcc.dg/analyzer/paths-3.c @@ -13,13 +13,12 @@ int test_1 (int a, int b) else p = malloc (32); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "4 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ if (a > 5) { free (p); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ } return 0; /* { dg-bogus "leak" } */ @@ -35,13 +34,12 @@ int test_2 (int a, int b) else p = malloc (32); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "4 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ if (a > 6) /* different condition */ { free (p); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ } return 0; /* { dg-warning "leak of 'p'" } */ diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-4.c b/gcc/testsuite/gcc.dg/analyzer/paths-4.c index 34bd09e..2f58763 100644 --- a/gcc/testsuite/gcc.dg/analyzer/paths-4.c +++ b/gcc/testsuite/gcc.dg/analyzer/paths-4.c @@ -10,41 +10,43 @@ extern void do_stuff (struct state *, int); int test_1 (struct state *s) { - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ while (1) { - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ + /* TODO: why does the above need an extra stmt to merge state? */ do_stuff (s, s->mode); } } int test_2 (struct state *s) { - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ while (1) { - __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ + /* TODO: why does the above need an extra stmt to merge state? */ switch (s->mode) { case 0: - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ do_stuff (s, 0); break; case 1: - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ do_stuff (s, 17); break; case 2: - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ do_stuff (s, 5); break; case 3: - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ return 42; case 4: - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ return -3; } } diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-5.c b/gcc/testsuite/gcc.dg/analyzer/paths-5.c index f96169d..21aa230 100644 --- a/gcc/testsuite/gcc.dg/analyzer/paths-5.c +++ b/gcc/testsuite/gcc.dg/analyzer/paths-5.c @@ -3,10 +3,10 @@ void test (int *p, int n) { int i; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ for (i = 0; i < n; i++) { p[i] = i; /* { dg-bogus "uninitialized" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ } } diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-6.c b/gcc/testsuite/gcc.dg/analyzer/paths-6.c index 7a1a942..8220b8e 100644 --- a/gcc/testsuite/gcc.dg/analyzer/paths-6.c +++ b/gcc/testsuite/gcc.dg/analyzer/paths-6.c @@ -19,9 +19,7 @@ void test_1 (int flag) a = 3; } - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - // FIXME: the above can vary between 2 and 3 exploded nodes - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ __analyzer_eval (a == 3); /* { dg-warning "TRUE" } */ __analyzer_eval (b == 4); /* { dg-warning "TRUE" } */ } @@ -42,8 +40,7 @@ void test_2 (int flag) f = 3; } - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ __analyzer_eval (f == 3); /* { dg-warning "TRUE" } */ __analyzer_eval (g == 4); /* { dg-warning "TRUE" } */ } @@ -92,8 +89,7 @@ void test_3 (int i) break; } - __analyzer_dump_exploded_nodes (0); /* { dg-warning "6 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enode" } */ __analyzer_eval (f == 3); /* { dg-warning "TRUE" } */ __analyzer_eval (g == 4); /* { dg-warning "TRUE" } */ __analyzer_eval (h == 5); /* { dg-warning "TRUE" } */ @@ -112,8 +108,7 @@ void test_4 (int flag) q = malloc (256); p = malloc (256); } - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ free (p); free (q); } diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-7.c b/gcc/testsuite/gcc.dg/analyzer/paths-7.c index 6a99e64..243b963 100644 --- a/gcc/testsuite/gcc.dg/analyzer/paths-7.c +++ b/gcc/testsuite/gcc.dg/analyzer/paths-7.c @@ -9,12 +9,12 @@ int test (int flag, void *ptr, int *p, int n) int sum = 0; int i; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ if (flag) free (ptr); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ for (i = 0; i < n; i++) p[i] = i; @@ -22,7 +22,7 @@ int test (int flag, void *ptr, int *p, int n) sum += foo (p[i]); /* { dg-bogus "uninitialized" } */ result = sum; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ if (flag) free (ptr); /* { dg-warning "double-'free' of 'ptr'" } */ @@ -37,12 +37,12 @@ int test_2 (int flag, int *p, int n) void *ptr = malloc (16); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ if (flag) free (ptr); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ for (i = 0; i < n; i++) p[i] = i; @@ -50,8 +50,7 @@ int test_2 (int flag, int *p, int n) sum += foo (p[i]); /* { dg-bogus "uninitialized" } */ result = sum; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "5 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "5 exploded nodes" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "5 processed enodes" } */ // FIXME: why 5 here? free (ptr); /* { dg-warning "double-'free' of 'ptr'" } */ diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/conditionals-2.c b/gcc/testsuite/gcc.dg/analyzer/torture/conditionals-2.c index 5580d22..35b0a05f 100644 --- a/gcc/testsuite/gcc.dg/analyzer/torture/conditionals-2.c +++ b/gcc/testsuite/gcc.dg/analyzer/torture/conditionals-2.c @@ -7,7 +7,7 @@ static void __attribute__((noinline)) test_1_callee (void *p, void *q) { - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ __analyzer_eval (p == Z_NULL); /* { dg-warning "FALSE" } */ __analyzer_eval (p != Z_NULL); /* { dg-warning "TRUE" } */ @@ -27,7 +27,7 @@ void test_1 (void *p, void *q) static void __attribute__((noinline)) test_2_callee (void *p, void *q) { - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ __analyzer_eval (p == Z_NULL); /* { dg-warning "FALSE" } */ __analyzer_eval (p != Z_NULL); /* { dg-warning "TRUE" } */ diff --git a/gcc/testsuite/gcc.dg/analyzer/zlib-1.c b/gcc/testsuite/gcc.dg/analyzer/zlib-1.c index 5537c98..171af3d 100644 --- a/gcc/testsuite/gcc.dg/analyzer/zlib-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/zlib-1.c @@ -21,49 +21,44 @@ int deflateEnd(z_stream *strm) { int status; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ if (strm == 0 || strm->state == 0) return (-2); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ status = strm->state->status; if (status != 42 && status != 113 && status != 666) { return (-2); } - __analyzer_dump_exploded_nodes (0); /* { dg-warning "4 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ if (strm->state->pending_buf) (*(strm->zfree))(strm->opaque, (void *)(strm->state->pending_buf)); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ if (strm->state->head) (*(strm->zfree))(strm->opaque, (void *)(strm->state->head)); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ if (strm->state->prev) (*(strm->zfree))(strm->opaque, (void *)(strm->state->prev)); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ if (strm->state->window) (*(strm->zfree))(strm->opaque, (void *)(strm->state->window)); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ (*(strm->zfree))(strm->opaque, (void *)(strm->state)); strm->state = 0; - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ return status == 113 ? (-3) : 0; } diff --git a/gcc/testsuite/gcc.dg/analyzer/zlib-5.c b/gcc/testsuite/gcc.dg/analyzer/zlib-5.c index 715604d..afb6102 100644 --- a/gcc/testsuite/gcc.dg/analyzer/zlib-5.c +++ b/gcc/testsuite/gcc.dg/analyzer/zlib-5.c @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) { if (compr == 0 || uncompr == 0) exit(1); - __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ + __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ test_compress(compr, comprLen, uncompr, uncomprLen); |