Skip to content

Commit c7cff37

Browse files
committed
C++: Add another testcase with conflation.
1 parent 3365ff0 commit c7cff37

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ postWithInFlow
129129
| test.cpp:694:4:694:6 | buf [inner post update] | PostUpdateNode should not be the target of local flow. |
130130
| test.cpp:704:23:704:25 | buf [inner post update] | PostUpdateNode should not be the target of local flow. |
131131
| test.cpp:715:25:715:25 | c [inner post update] | PostUpdateNode should not be the target of local flow. |
132+
| test.cpp:728:3:728:4 | * ... [post update] | PostUpdateNode should not be the target of local flow. |
133+
| test.cpp:728:4:728:4 | p [inner post update] | PostUpdateNode should not be the target of local flow. |
134+
| test.cpp:734:41:734:41 | x [inner post update] | PostUpdateNode should not be the target of local flow. |
132135
viableImplInCallContextTooLarge
133136
uniqueParameterNodeAtPosition
134137
uniqueParameterNodePosition

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,8 +715,22 @@ void write_to_star_buf(unsigned char *buf) // $ ast-def=buf
715715
write_to_star_star_p(&c);
716716
}
717717

718-
void test(unsigned char *source) // $ ast-def=source
718+
void test_write_to_star_buf(unsigned char *source) // $ ast-def=source
719719
{
720720
write_to_star_buf(source);
721721
sink(*source); // clean
722-
}
722+
}
723+
724+
void does_not_write_source_to_dereference(int *p) // $ ast-def=p ir-def=*p
725+
{
726+
int x = source();
727+
p = &x;
728+
*p = 42;
729+
}
730+
731+
void test_does_not_write_source_to_dereference()
732+
{
733+
int x;
734+
does_not_write_source_to_dereference(&x);
735+
sink(x); // $ ast,ir=733:7 SPURIOUS: ast,ir=726:11
736+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@
4242
| test.cpp:551:9:551:9 | y | test.cpp:552:28:552:28 | y |
4343
| test.cpp:595:8:595:9 | xs | test.cpp:596:3:596:4 | xs |
4444
| test.cpp:595:8:595:9 | xs | test.cpp:597:9:597:10 | xs |
45+
| test.cpp:733:7:733:7 | x | test.cpp:734:41:734:41 | x |
46+
| test.cpp:733:7:733:7 | x | test.cpp:735:8:735:8 | x |

0 commit comments

Comments
 (0)