C++: test for global var access in a global var

This commit is contained in:
Robert Marsh
2022-05-02 12:07:01 -04:00
parent fe52dd93ef
commit b5a2a2e8c2
3 changed files with 15 additions and 7 deletions

View File

@@ -1766,4 +1766,6 @@ constructor_only global_5 = constructor_only(2);
char *global_string = "global string";
int global_6 = global_2;
// semmle-extractor-options: -std=c++17 --clang

View File

@@ -28,13 +28,7 @@ nonUniqueEnclosingIRFunction
fieldAddressOnNonPointer
thisArgumentIsNonPointer
nonUniqueIRVariable
| ir.cpp:1038:6:1038:8 | VariableAddress: lam | Variable address instruction 'VariableAddress: lam' has no associated variable, in function '$@'. | ir.cpp:1038:6:1038:8 | (lambda [] type at line 1038, col. 12) lam | (lambda [] type at line 1038, col. 12) lam |
| ir.cpp:1759:5:1759:12 | VariableAddress: global_2 | Variable address instruction 'VariableAddress: global_2' has no associated variable, in function '$@'. | ir.cpp:1759:5:1759:12 | int global_2 | int global_2 |
| ir.cpp:1761:11:1761:18 | VariableAddress: global_3 | Variable address instruction 'VariableAddress: global_3' has no associated variable, in function '$@'. | ir.cpp:1761:11:1761:18 | int const global_3 | int const global_3 |
| ir.cpp:1763:18:1763:25 | VariableAddress: global_4 | Variable address instruction 'VariableAddress: global_4' has no associated variable, in function '$@'. | ir.cpp:1763:18:1763:25 | constructor_only global_4 | constructor_only global_4 |
| ir.cpp:1765:18:1765:25 | VariableAddress: global_5 | Variable address instruction 'VariableAddress: global_5' has no associated variable, in function '$@'. | ir.cpp:1765:18:1765:25 | constructor_only global_5 | constructor_only global_5 |
| ir.cpp:1767:7:1767:19 | VariableAddress: global_string | Variable address instruction 'VariableAddress: global_string' has no associated variable, in function '$@'. | ir.cpp:1767:7:1767:19 | char* global_string | char* global_string |
| struct_init.cpp:9:13:9:25 | VariableAddress: infos_in_file | Variable address instruction 'VariableAddress: infos_in_file' has no associated variable, in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] |
| ir.cpp:1769:16:1769:23 | VariableAddress: global_2 | Variable address instruction 'VariableAddress: global_2' has no associated variable, in function '$@'. | ir.cpp:1769:5:1769:12 | int global_6 | int global_6 |
missingCanonicalLanguageType
multipleCanonicalLanguageTypes
missingIRType

View File

@@ -9494,6 +9494,18 @@ ir.cpp:
# 1767| v1767_9(void) = AliasedUse : ~m?
# 1767| v1767_10(void) = ExitFunction :
# 1769| int global_6
# 1769| Block 0
# 1769| v1769_1(void) = EnterFunction :
# 1769| mu1769_2(unknown) = AliasedDefinition :
# 1769| r1769_3(glval<int>) = VariableAddress[global_6] :
# 1769| r1769_4(glval<int>) = VariableAddress :
# 1769| r1769_5(int) = Load[?] : &:r1769_4, ~m?
# 1769| mu1769_6(int) = Store[global_6] : &:r1769_3, r1769_5
# 1769| v1769_7(void) = ReturnVoid :
# 1769| v1769_8(void) = AliasedUse : ~m?
# 1769| v1769_9(void) = ExitFunction :
perf-regression.cpp:
# 6| void Big::Big()
# 6| Block 0