Skip to content

Commit a3f1d61

Browse files
committed
C++: test for global var access in a global var
1 parent 048e5d8 commit a3f1d61

8 files changed

+26
-0
lines changed

cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ nonUniqueEnclosingIRFunction
2424
fieldAddressOnNonPointer
2525
thisArgumentIsNonPointer
2626
nonUniqueIRVariable
27+
| ir.cpp:1831:16:1831:23 | VariableAddress: global_2 | Variable address instruction 'VariableAddress: global_2' has no associated variable, in function '$@'. | ir.cpp:1831:5:1831:12 | int global_6 | int global_6 |
2728
missingCanonicalLanguageType
2829
multipleCanonicalLanguageTypes
2930
missingIRType

cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ nonUniqueEnclosingIRFunction
2424
fieldAddressOnNonPointer
2525
thisArgumentIsNonPointer
2626
nonUniqueIRVariable
27+
| ir.cpp:1831:16:1831:23 | VariableAddress: global_2 | Variable address instruction 'VariableAddress: global_2' has no associated variable, in function '$@'. | ir.cpp:1831:5:1831:12 | int global_6 | int global_6 |
2728
missingCanonicalLanguageType
2829
multipleCanonicalLanguageTypes
2930
missingIRType

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,4 +1828,6 @@ constructor_only global_5 = constructor_only(2);
18281828

18291829
char *global_string = "global string";
18301830

1831+
int global_6 = global_2;
1832+
18311833
// semmle-extractor-options: -std=c++17 --clang

cpp/ql/test/library-tests/ir/ir/operand_locations.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8502,6 +8502,13 @@
85028502
| ir.cpp:1829:23:1829:37 | StoreValue | r1829_6 |
85038503
| ir.cpp:1829:23:1829:37 | Unary | r1829_4 |
85048504
| ir.cpp:1829:23:1829:37 | Unary | r1829_5 |
8505+
| ir.cpp:1831:5:1831:12 | Address | &:r1831_3 |
8506+
| ir.cpp:1831:5:1831:12 | SideEffect | ~m1831_7 |
8507+
| ir.cpp:1831:16:1831:23 | Address | &:r1831_4 |
8508+
| ir.cpp:1831:16:1831:23 | ChiPartial | partial:m1831_6 |
8509+
| ir.cpp:1831:16:1831:23 | ChiTotal | total:m1831_2 |
8510+
| ir.cpp:1831:16:1831:23 | Load | ~m1831_2 |
8511+
| ir.cpp:1831:16:1831:23 | StoreValue | r1831_5 |
85058512
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
85068513
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
85078514
| perf-regression.cpp:6:3:6:5 | Address | &:r6_7 |

cpp/ql/test/library-tests/ir/ir/raw_consistency.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ nonUniqueEnclosingIRFunction
2828
fieldAddressOnNonPointer
2929
thisArgumentIsNonPointer
3030
nonUniqueIRVariable
31+
| ir.cpp:1831:16:1831:23 | VariableAddress: global_2 | Variable address instruction 'VariableAddress: global_2' has no associated variable, in function '$@'. | ir.cpp:1831:5:1831:12 | int global_6 | int global_6 |
3132
missingCanonicalLanguageType
3233
multipleCanonicalLanguageTypes
3334
missingIRType

cpp/ql/test/library-tests/ir/ir/raw_ir.expected

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9796,6 +9796,18 @@ ir.cpp:
97969796
# 1829| v1829_9(void) = AliasedUse : ~m?
97979797
# 1829| v1829_10(void) = ExitFunction :
97989798

9799+
# 1831| int global_6
9800+
# 1831| Block 0
9801+
# 1831| v1831_1(void) = EnterFunction :
9802+
# 1831| mu1831_2(unknown) = AliasedDefinition :
9803+
# 1831| r1831_3(glval<int>) = VariableAddress[global_6] :
9804+
# 1831| r1831_4(glval<int>) = VariableAddress :
9805+
# 1831| r1831_5(int) = Load[?] : &:r1831_4, ~m?
9806+
# 1831| mu1831_6(int) = Store[global_6] : &:r1831_3, r1831_5
9807+
# 1831| v1831_7(void) = ReturnVoid :
9808+
# 1831| v1831_8(void) = AliasedUse : ~m?
9809+
# 1831| v1831_9(void) = ExitFunction :
9810+
97999811
perf-regression.cpp:
98009812
# 6| void Big::Big()
98019813
# 6| Block 0

cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ nonUniqueEnclosingIRFunction
2424
fieldAddressOnNonPointer
2525
thisArgumentIsNonPointer
2626
nonUniqueIRVariable
27+
| ir.cpp:1831:16:1831:23 | VariableAddress: global_2 | Variable address instruction 'VariableAddress: global_2' has no associated variable, in function '$@'. | ir.cpp:1831:5:1831:12 | int global_6 | int global_6 |
2728
missingCanonicalLanguageType
2829
multipleCanonicalLanguageTypes
2930
missingIRType

cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ nonUniqueEnclosingIRFunction
2424
fieldAddressOnNonPointer
2525
thisArgumentIsNonPointer
2626
nonUniqueIRVariable
27+
| ir.cpp:1831:16:1831:23 | VariableAddress: global_2 | Variable address instruction 'VariableAddress: global_2' has no associated variable, in function '$@'. | ir.cpp:1831:5:1831:12 | int global_6 | int global_6 |
2728
missingCanonicalLanguageType
2829
multipleCanonicalLanguageTypes
2930
missingIRType

0 commit comments

Comments
 (0)