Skip to content

Commit 9970f78

Browse files
committed
C++: Add pointer/pointee conflation test.
1 parent d8ec6dd commit 9970f78

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-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
@@ -185,6 +185,8 @@ postWithInFlow
185185
| test.cpp:1138:5:1138:8 | data [inner post update] | PostUpdateNode should not be the target of local flow. |
186186
| test.cpp:1139:3:1139:7 | * ... [post update] | PostUpdateNode should not be the target of local flow. |
187187
| test.cpp:1139:4:1139:7 | data [inner post update] | PostUpdateNode should not be the target of local flow. |
188+
| test.cpp:1153:5:1153:6 | * ... [post update] | PostUpdateNode should not be the target of local flow. |
189+
| test.cpp:1153:6:1153:6 | p [inner post update] | PostUpdateNode should not be the target of local flow. |
188190
viableImplInCallContextTooLarge
189191
uniqueParameterNodeAtPosition
190192
uniqueParameterNodePosition

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
@@ -327,6 +327,7 @@ irFlow
327327
| test.cpp:1117:27:1117:34 | call to source | test.cpp:1117:27:1117:34 | call to source |
328328
| test.cpp:1132:11:1132:16 | call to source | test.cpp:1121:8:1121:8 | x |
329329
| test.cpp:1138:17:1138:22 | call to source | test.cpp:1140:8:1140:18 | * ... |
330+
| test.cpp:1153:10:1153:15 | call to source | test.cpp:1148:10:1148:12 | * ... |
330331
| true_upon_entry.cpp:9:11:9:16 | call to source | true_upon_entry.cpp:13:8:13:8 | x |
331332
| true_upon_entry.cpp:17:11:17:16 | call to source | true_upon_entry.cpp:21:8:21:8 | x |
332333
| true_upon_entry.cpp:27:9:27:14 | call to source | true_upon_entry.cpp:29:8:29:8 | x |

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,4 +1138,19 @@ void test_uncertain_array(int n1, int n2) {
11381138
*(data + 1) = source();
11391139
*data = 0;
11401140
sink(*(data + 1)); // $ ast=1138:17 ast=1137:7 ir
1141+
}
1142+
1143+
namespace conflation_regression {
1144+
1145+
char* source(int);
1146+
1147+
void read_deref_deref(char **l) { // $ ast-def=l ir-def=*l ir-def=**l
1148+
sink(**l); // $ SPURIOUS: ir
1149+
}
1150+
1151+
void f(char ** p) // $ ast-def=p ir-def=*p ir-def=**p
1152+
{
1153+
*p = source(0);
1154+
read_deref_deref(p);
1155+
}
11411156
}

0 commit comments

Comments
 (0)