Skip to content

Commit 9bc7ce1

Browse files
authored
Merge pull request #2141 from geoffw0/newtest
CPP: AV Rule 114 test cases
2 parents dfed750 + 5f1fdd0 commit 9bc7ce1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/AV Rule 114.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
| complex.c:3:2:3:45 | declaration | Function complexTest1 should return a value of type _Complex double but does not return a value here |
2+
| complex.c:7:2:7:41 | declaration | Function complexTest2 should return a value of type _Complex double but does not return a value here |
13
| test.c:8:5:8:14 | declaration | Function f2 should return a value of type int but does not return a value here |
24
| test.c:25:9:25:14 | ExprStmt | Function f4 should return a value of type int but does not return a value here |
35
| test.c:39:9:39:14 | ExprStmt | Function f6 should return a value of type int but does not return a value here |
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
_Complex double complexTest1(float a, float b) {
3+
_Complex double x = __builtin_complex(a, b); // BAD
4+
}
5+
6+
_Complex double complexTest2(float a, float b) {
7+
auto x = __builtin_complex(a, b) * 2.0f; // BAD
8+
}
9+
10+
_Complex double complexTest3(float a, float b) {
11+
return __builtin_complex(a, b); // GOOD
12+
}
13+
14+
auto complexTest4(float a, float b) {
15+
return __builtin_complex(a, b) * 2.0f; // GOOD
16+
}

0 commit comments

Comments
 (0)