Skip to content

Commit a6adf82

Browse files
committed
C++: Add a test that needs indirect barrier guards.
1 parent 0f0384c commit a6adf82

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
int source();
2-
void sink(int);
2+
void sink(...);
33
bool guarded(int);
44

55
void bg_basic(int source) {
@@ -66,3 +66,13 @@ void bg_structptr(XY *p1, XY *p2) { // $ ast-def=p1 ast-def=p2
6666
sink(p1->x); // $ ast,ir
6767
}
6868
}
69+
70+
int* indirect_source();
71+
bool guarded(const int*);
72+
73+
void bg_indirect_expr() {
74+
int *buf = indirect_source();
75+
if (guarded(buf)) {
76+
sink(buf); // $ SPURIOUS: ir
77+
}
78+
}

0 commit comments

Comments
 (0)