Skip to content

Commit cc75485

Browse files
committed
C++: Add a testcase with missing flow out of the address of 'a' and to the argument of 'sink'.
1 parent a60afef commit cc75485

File tree

6 files changed

+25
-0
lines changed

6 files changed

+25
-0
lines changed

cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-consistency.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ postWithInFlow
166166
| test.cpp:932:5:932:19 | * ... [post update] | PostUpdateNode should not be the target of local flow. |
167167
| test.cpp:932:6:932:19 | global_pointer [inner post update] | PostUpdateNode should not be the target of local flow. |
168168
| test.cpp:1045:9:1045:11 | ref arg buf | PostUpdateNode should not be the target of local flow. |
169+
| test.cpp:1051:5:1051:11 | content [post update] | PostUpdateNode should not be the target of local flow. |
170+
| test.cpp:1052:9:1052:9 | a [inner post update] | PostUpdateNode should not be the target of local flow. |
169171
viableImplInCallContextTooLarge
170172
uniqueParameterNodeAtPosition
171173
uniqueParameterNodePosition

cpp/ql/test/library-tests/dataflow/dataflow-tests/localFlow-ir.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,10 @@
158158
| test.cpp:489:23:489:29 | *content | test.cpp:490:8:490:17 | * ... |
159159
| test.cpp:489:23:489:29 | content | test.cpp:489:23:489:29 | content |
160160
| test.cpp:489:23:489:29 | content | test.cpp:490:9:490:17 | p_content |
161+
| test.cpp:1050:12:1050:12 | definition of a | test.cpp:1051:3:1051:3 | *a |
162+
| test.cpp:1051:3:1051:3 | *a | test.cpp:1052:8:1052:9 | *& ... |
163+
| test.cpp:1051:3:1051:3 | *a [post update] | test.cpp:1052:8:1052:9 | *& ... |
164+
| test.cpp:1051:15:1051:21 | 0 | test.cpp:1051:3:1051:21 | ... = ... |
165+
| test.cpp:1051:15:1051:21 | *0 | test.cpp:1051:3:1051:21 | *... = ... |
166+
| test.cpp:1052:9:1052:9 | *a | test.cpp:1052:8:1052:9 | *& ... |
167+
| test.cpp:1052:9:1052:9 | a | test.cpp:1052:8:1052:9 | & ... |

cpp/ql/test/library-tests/dataflow/dataflow-tests/localFlow.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,10 @@ WARNING: Module DataFlow has been deprecated and may be removed in future (local
8181
| test.cpp:488:21:488:21 | s [post update] | test.cpp:489:20:489:20 | s |
8282
| test.cpp:488:24:488:30 | ref arg content | test.cpp:489:23:489:29 | content |
8383
| test.cpp:489:23:489:29 | content | test.cpp:490:9:490:17 | p_content |
84+
| test.cpp:1050:12:1050:12 | a | test.cpp:1051:3:1051:3 | a |
85+
| test.cpp:1050:12:1050:12 | a | test.cpp:1052:9:1052:9 | a |
86+
| test.cpp:1051:3:1051:3 | a [post update] | test.cpp:1052:9:1052:9 | a |
87+
| test.cpp:1051:3:1051:21 | ... = ... | test.cpp:1051:5:1051:11 | content [post update] |
88+
| test.cpp:1051:15:1051:21 | 0 | test.cpp:1051:3:1051:21 | ... = ... |
89+
| test.cpp:1052:8:1052:9 | ref arg & ... | test.cpp:1052:9:1052:9 | a [inner post update] |
90+
| test.cpp:1052:9:1052:9 | a | test.cpp:1052:8:1052:9 | & ... |

cpp/ql/test/library-tests/dataflow/dataflow-tests/test-source-sink.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ astFlow
123123
| test.cpp:842:11:842:16 | call to source | test.cpp:844:8:844:8 | y |
124124
| test.cpp:846:13:846:27 | call to indirect_source | test.cpp:848:23:848:25 | rpx |
125125
| test.cpp:860:54:860:59 | call to source | test.cpp:861:10:861:37 | static_local_pointer_dynamic |
126+
| test.cpp:1050:12:1050:12 | a | test.cpp:1052:8:1052:9 | & ... |
126127
| true_upon_entry.cpp:17:11:17:16 | call to source | true_upon_entry.cpp:21:8:21:8 | x |
127128
| true_upon_entry.cpp:27:9:27:14 | call to source | true_upon_entry.cpp:29:8:29:8 | x |
128129
| true_upon_entry.cpp:33:11:33:16 | call to source | true_upon_entry.cpp:39:8:39:8 | x |

cpp/ql/test/library-tests/dataflow/dataflow-tests/test.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,4 +1044,10 @@ void* memset(void*, int, size_t);
10441044
void memset_test(char* buf) { // $ ast-def=buf ir-def=*buf
10451045
memset(buf, source(), 10);
10461046
sink(*buf); // $ ir MISSING: ast
1047+
}
1048+
1049+
void flow_out_of_address_with_local_flow() {
1050+
MyStruct a;
1051+
a.content = nullptr;
1052+
sink(&a); // $ SPURIOUS: ast
10471053
}

cpp/ql/test/library-tests/dataflow/dataflow-tests/uninitialized.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,5 @@
5454
| test.cpp:796:12:796:12 | a | test.cpp:797:20:797:20 | a |
5555
| test.cpp:796:12:796:12 | a | test.cpp:797:31:797:31 | a |
5656
| test.cpp:796:12:796:12 | a | test.cpp:798:17:798:17 | a |
57+
| test.cpp:1050:12:1050:12 | a | test.cpp:1051:3:1051:3 | a |
58+
| test.cpp:1050:12:1050:12 | a | test.cpp:1052:9:1052:9 | a |

0 commit comments

Comments
 (0)