Skip to content

Commit 44c1c5a

Browse files
author
Dave Bartolomeo
committed
C++: Update points_to.ql test to use new bit offset format
1 parent 521fbb1 commit 44c1c5a

File tree

4 files changed

+101
-132
lines changed

4 files changed

+101
-132
lines changed

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasAnalysis.qll

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,6 @@ private import semmle.code.cpp.models.interfaces.Alias
66

77
private class IntValue = Ints::IntValue;
88

9-
/**
10-
* Converts the bit count in `bits` to a byte count and a bit count in the form
11-
* bytes:bits.
12-
*/
13-
bindingset[bits]
14-
string bitsToBytesAndBits(int bits) { result = (bits / 8).toString() + ":" + (bits % 8).toString() }
15-
16-
/**
17-
* Gets a printable string for a bit offset with possibly unknown value.
18-
*/
19-
bindingset[bitOffset]
20-
string getBitOffsetString(IntValue bitOffset) {
21-
if Ints::hasValue(bitOffset)
22-
then
23-
if bitOffset >= 0
24-
then result = "+" + bitsToBytesAndBits(bitOffset)
25-
else result = "-" + bitsToBytesAndBits(Ints::neg(bitOffset))
26-
else result = "+?"
27-
}
28-
299
/**
3010
* Gets the offset of field `field` in bits.
3111
*/
@@ -137,7 +117,11 @@ private predicate operandIsPropagated(Operand operand, IntValue bitOffset) {
137117
or
138118
// Adding an integer to or subtracting an integer from a pointer propagates
139119
// the address with an offset.
140-
bitOffset = getPointerBitOffset(instr.(PointerOffsetInstruction))
120+
exists(PointerOffsetInstruction ptrOffset |
121+
ptrOffset = instr and
122+
operand = ptrOffset.getLeftOperand() and
123+
bitOffset = getPointerBitOffset(ptrOffset)
124+
)
141125
or
142126
// Computing a field address from a pointer propagates the address plus the
143127
// offset of the field.

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/AliasAnalysis.qll

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,6 @@ private import semmle.code.cpp.models.interfaces.Alias
66

77
private class IntValue = Ints::IntValue;
88

9-
/**
10-
* Converts the bit count in `bits` to a byte count and a bit count in the form
11-
* bytes:bits.
12-
*/
13-
bindingset[bits]
14-
string bitsToBytesAndBits(int bits) { result = (bits / 8).toString() + ":" + (bits % 8).toString() }
15-
16-
/**
17-
* Gets a printable string for a bit offset with possibly unknown value.
18-
*/
19-
bindingset[bitOffset]
20-
string getBitOffsetString(IntValue bitOffset) {
21-
if Ints::hasValue(bitOffset)
22-
then
23-
if bitOffset >= 0
24-
then result = "+" + bitsToBytesAndBits(bitOffset)
25-
else result = "-" + bitsToBytesAndBits(Ints::neg(bitOffset))
26-
else result = "+?"
27-
}
28-
299
/**
3010
* Gets the offset of field `field` in bits.
3111
*/
@@ -137,7 +117,11 @@ private predicate operandIsPropagated(Operand operand, IntValue bitOffset) {
137117
or
138118
// Adding an integer to or subtracting an integer from a pointer propagates
139119
// the address with an offset.
140-
bitOffset = getPointerBitOffset(instr.(PointerOffsetInstruction))
120+
exists(PointerOffsetInstruction ptrOffset |
121+
ptrOffset = instr and
122+
operand = ptrOffset.getLeftOperand() and
123+
bitOffset = getPointerBitOffset(ptrOffset)
124+
)
141125
or
142126
// Computing a field address from a pointer propagates the address plus the
143127
// offset of the field.
Lines changed: 86 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,86 @@
1-
| escape.cpp:111:18:111:21 | CopyValue | no_+0:0 | no_+0:0 |
2-
| escape.cpp:115:19:115:28 | PointerAdd[4] | no_+0:0 | no_+0:0 |
3-
| escape.cpp:115:20:115:23 | CopyValue | no_+0:0 | no_+0:0 |
4-
| escape.cpp:116:19:116:28 | PointerSub[4] | no_+0:0 | no_+0:0 |
5-
| escape.cpp:116:20:116:23 | CopyValue | no_+0:0 | no_+0:0 |
6-
| escape.cpp:117:19:117:26 | PointerAdd[4] | no_+0:0 | no_+0:0 |
7-
| escape.cpp:117:23:117:26 | CopyValue | no_+0:0 | no_+0:0 |
8-
| escape.cpp:118:9:118:12 | CopyValue | no_+0:0 | no_+0:0 |
9-
| escape.cpp:120:12:120:15 | CopyValue | no_+0:0 | no_+0:0 |
10-
| escape.cpp:123:14:123:17 | CopyValue | no_+0:0 | no_+0:0 |
11-
| escape.cpp:124:15:124:18 | CopyValue | no_+0:0 | no_+0:0 |
12-
| escape.cpp:127:9:127:12 | CopyValue | no_+0:0 | no_+0:0 |
13-
| escape.cpp:129:12:129:15 | CopyValue | no_+0:0 | no_+0:0 |
14-
| escape.cpp:134:5:134:18 | Convert | no_Array+0:0 | no_Array+0:0 |
15-
| escape.cpp:134:11:134:18 | Convert | no_Array+0:0 | no_Array+0:0 |
16-
| escape.cpp:135:5:135:12 | Convert | no_Array+0:0 | no_Array+0:0 |
17-
| escape.cpp:135:5:135:15 | PointerAdd[4] | no_Array+20:0 | no_Array+20:0 |
18-
| escape.cpp:136:5:136:15 | PointerAdd[4] | no_Array+20:0 | no_Array+20:0 |
19-
| escape.cpp:136:7:136:14 | Convert | no_Array+0:0 | no_Array+0:0 |
20-
| escape.cpp:137:17:137:24 | Convert | no_Array+0:0 | no_Array+0:0 |
21-
| escape.cpp:137:17:137:27 | PointerAdd[4] | no_Array+20:0 | no_Array+20:0 |
22-
| escape.cpp:138:17:138:27 | PointerAdd[4] | no_Array+20:0 | no_Array+20:0 |
23-
| escape.cpp:138:19:138:26 | Convert | no_Array+0:0 | no_Array+0:0 |
24-
| escape.cpp:140:21:140:32 | FieldAddress[x] | no_Point+0:0 | no_Point+0:0 |
25-
| escape.cpp:140:21:140:32 | FieldAddress[y] | no_Point+4:0 | no_Point+4:0 |
26-
| escape.cpp:140:21:140:32 | FieldAddress[z] | no_Point+8:0 | no_Point+8:0 |
27-
| escape.cpp:141:27:141:27 | FieldAddress[x] | no_Point+0:0 | no_Point+0:0 |
28-
| escape.cpp:142:14:142:14 | FieldAddress[y] | no_Point+4:0 | no_Point+4:0 |
29-
| escape.cpp:143:19:143:27 | CopyValue | no_Point+0:0 | no_Point+0:0 |
30-
| escape.cpp:143:31:143:31 | FieldAddress[y] | no_Point+4:0 | no_Point+4:0 |
31-
| escape.cpp:144:6:144:14 | CopyValue | no_Point+0:0 | no_Point+0:0 |
32-
| escape.cpp:144:18:144:18 | FieldAddress[y] | no_Point+4:0 | no_Point+4:0 |
33-
| escape.cpp:145:20:145:30 | CopyValue | no_Point+8:0 | no_Point+8:0 |
34-
| escape.cpp:145:30:145:30 | FieldAddress[z] | no_Point+8:0 | no_Point+8:0 |
35-
| escape.cpp:146:5:146:18 | CopyValue | no_Point+8:0 | no_Point+8:0 |
36-
| escape.cpp:146:7:146:17 | CopyValue | no_Point+8:0 | no_Point+8:0 |
37-
| escape.cpp:146:17:146:17 | FieldAddress[z] | no_Point+8:0 | no_Point+8:0 |
38-
| escape.cpp:149:5:149:14 | ConvertToNonVirtualBase[Derived : Intermediate1] | no_Derived+0:0 | no_Derived+0:0 |
39-
| escape.cpp:149:5:149:14 | ConvertToNonVirtualBase[Intermediate1 : Base] | no_Derived+0:0 | no_Derived+0:0 |
40-
| escape.cpp:149:16:149:16 | FieldAddress[b] | no_Derived+0:0 | no_Derived+0:0 |
41-
| escape.cpp:150:18:150:27 | ConvertToNonVirtualBase[Derived : Intermediate1] | no_Derived+0:0 | no_Derived+0:0 |
42-
| escape.cpp:150:18:150:27 | ConvertToNonVirtualBase[Intermediate1 : Base] | no_Derived+0:0 | no_Derived+0:0 |
43-
| escape.cpp:150:29:150:29 | FieldAddress[b] | no_Derived+0:0 | no_Derived+0:0 |
44-
| escape.cpp:151:5:151:14 | ConvertToNonVirtualBase[Derived : Intermediate2] | no_Derived+12:0 | no_Derived+12:0 |
45-
| escape.cpp:151:16:151:17 | FieldAddress[i2] | no_Derived+16:0 | no_Derived+16:0 |
46-
| escape.cpp:152:19:152:28 | ConvertToNonVirtualBase[Derived : Intermediate2] | no_Derived+12:0 | no_Derived+12:0 |
47-
| escape.cpp:152:30:152:31 | FieldAddress[i2] | no_Derived+16:0 | no_Derived+16:0 |
48-
| escape.cpp:155:17:155:30 | CopyValue | no_ssa_addrOf+0:0 | no_ssa_addrOf+0:0 |
49-
| escape.cpp:155:17:155:30 | Store | no_ssa_addrOf+0:0 | no_ssa_addrOf+0:0 |
50-
| escape.cpp:158:17:158:28 | CopyValue | no_ssa_refTo+0:0 | no_ssa_refTo+0:0 |
51-
| escape.cpp:158:17:158:28 | Store | no_ssa_refTo+0:0 | no_ssa_refTo+0:0 |
52-
| escape.cpp:161:19:161:42 | Convert | no_ssa_refToArrayElement+0:0 | no_ssa_refToArrayElement+0:0 |
53-
| escape.cpp:161:19:161:45 | CopyValue | no_ssa_refToArrayElement+20:0 | no_ssa_refToArrayElement+20:0 |
54-
| escape.cpp:161:19:161:45 | PointerAdd[4] | no_ssa_refToArrayElement+20:0 | no_ssa_refToArrayElement+20:0 |
55-
| escape.cpp:161:19:161:45 | Store | no_ssa_refToArrayElement+20:0 | no_ssa_refToArrayElement+20:0 |
56-
| escape.cpp:164:24:164:40 | CopyValue | no_ssa_refToArray+0:0 | no_ssa_refToArray+0:0 |
57-
| escape.cpp:164:24:164:40 | Store | no_ssa_refToArray+0:0 | no_ssa_refToArray+0:0 |
58-
| escape.cpp:167:19:167:28 | CopyValue | passByPtr+0:0 | passByPtr+0:0 |
59-
| escape.cpp:170:21:170:29 | CopyValue | passByRef+0:0 | passByRef+0:0 |
60-
| escape.cpp:173:22:173:38 | CopyValue | no_ssa_passByPtr+0:0 | no_ssa_passByPtr+0:0 |
61-
| escape.cpp:176:24:176:39 | CopyValue | no_ssa_passByRef+0:0 | no_ssa_passByRef+0:0 |
62-
| escape.cpp:179:22:179:42 | CopyValue | no_ssa_passByPtr_ret+0:0 | no_ssa_passByPtr_ret+0:0 |
63-
| escape.cpp:182:24:182:43 | CopyValue | no_ssa_passByRef_ret+0:0 | no_ssa_passByRef_ret+0:0 |
64-
| escape.cpp:185:30:185:40 | CopyValue | passByPtr2+0:0 | passByPtr2+0:0 |
65-
| escape.cpp:188:32:188:41 | CopyValue | passByRef2+0:0 | passByRef2+0:0 |
66-
| escape.cpp:191:30:191:42 | Call | none | passByPtr3+0:0 |
67-
| escape.cpp:191:44:191:54 | CopyValue | passByPtr3+0:0 | passByPtr3+0:0 |
68-
| escape.cpp:194:32:194:46 | Call | none | passByRef3+0:0 |
69-
| escape.cpp:194:32:194:59 | CopyValue | none | passByRef3+0:0 |
70-
| escape.cpp:194:48:194:57 | CopyValue | passByRef3+0:0 | passByRef3+0:0 |
71-
| escape.cpp:199:17:199:34 | CopyValue | no_ssa_passByPtr4+0:0 | no_ssa_passByPtr4+0:0 |
72-
| escape.cpp:199:37:199:54 | CopyValue | no_ssa_passByPtr5+0:0 | no_ssa_passByPtr5+0:0 |
73-
| escape.cpp:202:5:202:19 | Call | none | passByRef6+0:0 |
74-
| escape.cpp:202:5:202:32 | CopyValue | none | passByRef6+0:0 |
75-
| escape.cpp:202:21:202:30 | CopyValue | passByRef6+0:0 | passByRef6+0:0 |
76-
| escape.cpp:205:5:205:19 | Call | none | no_ssa_passByRef7+0:0 |
77-
| escape.cpp:205:5:205:39 | CopyValue | none | no_ssa_passByRef7+0:0 |
78-
| escape.cpp:205:21:205:37 | CopyValue | no_ssa_passByRef7+0:0 | no_ssa_passByRef7+0:0 |
79-
| escape.cpp:209:14:209:25 | Call | none | no_ssa_c+0:0 |
80-
| escape.cpp:217:14:217:16 | CopyValue | c2+0:0 | c2+0:0 |
81-
| escape.cpp:221:8:221:19 | Call | none | c3+0:0 |
82-
| escape.cpp:225:17:225:28 | Call | none | c4+0:0 |
83-
| escape.cpp:247:2:247:27 | Store | condEscape1+0:0 | condEscape1+0:0 |
84-
| escape.cpp:247:16:247:27 | CopyValue | condEscape1+0:0 | condEscape1+0:0 |
85-
| escape.cpp:249:9:249:34 | Store | condEscape2+0:0 | condEscape2+0:0 |
86-
| escape.cpp:249:23:249:34 | CopyValue | condEscape2+0:0 | condEscape2+0:0 |
1+
| escape.cpp:111:18:111:21 | CopyValue | no_+0 | no_+0 |
2+
| escape.cpp:115:19:115:28 | PointerAdd[4] | no_+0 | no_+0 |
3+
| escape.cpp:115:20:115:23 | CopyValue | no_+0 | no_+0 |
4+
| escape.cpp:116:19:116:28 | PointerSub[4] | no_+0 | no_+0 |
5+
| escape.cpp:116:20:116:23 | CopyValue | no_+0 | no_+0 |
6+
| escape.cpp:117:19:117:26 | PointerAdd[4] | no_+0 | no_+0 |
7+
| escape.cpp:117:23:117:26 | CopyValue | no_+0 | no_+0 |
8+
| escape.cpp:118:9:118:12 | CopyValue | no_+0 | no_+0 |
9+
| escape.cpp:120:12:120:15 | CopyValue | no_+0 | no_+0 |
10+
| escape.cpp:123:14:123:17 | CopyValue | no_+0 | no_+0 |
11+
| escape.cpp:124:15:124:18 | CopyValue | no_+0 | no_+0 |
12+
| escape.cpp:127:9:127:12 | CopyValue | no_+0 | no_+0 |
13+
| escape.cpp:129:12:129:15 | CopyValue | no_+0 | no_+0 |
14+
| escape.cpp:134:5:134:18 | Convert | no_Array+0 | no_Array+0 |
15+
| escape.cpp:134:11:134:18 | Convert | no_Array+0 | no_Array+0 |
16+
| escape.cpp:135:5:135:12 | Convert | no_Array+0 | no_Array+0 |
17+
| escape.cpp:135:5:135:15 | PointerAdd[4] | no_Array+20 | no_Array+20 |
18+
| escape.cpp:136:5:136:15 | PointerAdd[4] | no_Array+20 | no_Array+20 |
19+
| escape.cpp:136:7:136:14 | Convert | no_Array+0 | no_Array+0 |
20+
| escape.cpp:137:17:137:24 | Convert | no_Array+0 | no_Array+0 |
21+
| escape.cpp:137:17:137:27 | PointerAdd[4] | no_Array+20 | no_Array+20 |
22+
| escape.cpp:138:17:138:27 | PointerAdd[4] | no_Array+20 | no_Array+20 |
23+
| escape.cpp:138:19:138:26 | Convert | no_Array+0 | no_Array+0 |
24+
| escape.cpp:140:21:140:32 | FieldAddress[x] | no_Point+0 | no_Point+0 |
25+
| escape.cpp:140:21:140:32 | FieldAddress[y] | no_Point+4 | no_Point+4 |
26+
| escape.cpp:140:21:140:32 | FieldAddress[z] | no_Point+8 | no_Point+8 |
27+
| escape.cpp:141:27:141:27 | FieldAddress[x] | no_Point+0 | no_Point+0 |
28+
| escape.cpp:142:14:142:14 | FieldAddress[y] | no_Point+4 | no_Point+4 |
29+
| escape.cpp:143:19:143:27 | CopyValue | no_Point+0 | no_Point+0 |
30+
| escape.cpp:143:31:143:31 | FieldAddress[y] | no_Point+4 | no_Point+4 |
31+
| escape.cpp:144:6:144:14 | CopyValue | no_Point+0 | no_Point+0 |
32+
| escape.cpp:144:18:144:18 | FieldAddress[y] | no_Point+4 | no_Point+4 |
33+
| escape.cpp:145:20:145:30 | CopyValue | no_Point+8 | no_Point+8 |
34+
| escape.cpp:145:30:145:30 | FieldAddress[z] | no_Point+8 | no_Point+8 |
35+
| escape.cpp:146:5:146:18 | CopyValue | no_Point+8 | no_Point+8 |
36+
| escape.cpp:146:7:146:17 | CopyValue | no_Point+8 | no_Point+8 |
37+
| escape.cpp:146:17:146:17 | FieldAddress[z] | no_Point+8 | no_Point+8 |
38+
| escape.cpp:149:5:149:14 | ConvertToNonVirtualBase[Derived : Intermediate1] | no_Derived+0 | no_Derived+0 |
39+
| escape.cpp:149:5:149:14 | ConvertToNonVirtualBase[Intermediate1 : Base] | no_Derived+0 | no_Derived+0 |
40+
| escape.cpp:149:16:149:16 | FieldAddress[b] | no_Derived+0 | no_Derived+0 |
41+
| escape.cpp:150:18:150:27 | ConvertToNonVirtualBase[Derived : Intermediate1] | no_Derived+0 | no_Derived+0 |
42+
| escape.cpp:150:18:150:27 | ConvertToNonVirtualBase[Intermediate1 : Base] | no_Derived+0 | no_Derived+0 |
43+
| escape.cpp:150:29:150:29 | FieldAddress[b] | no_Derived+0 | no_Derived+0 |
44+
| escape.cpp:151:5:151:14 | ConvertToNonVirtualBase[Derived : Intermediate2] | no_Derived+12 | no_Derived+12 |
45+
| escape.cpp:151:16:151:17 | FieldAddress[i2] | no_Derived+16 | no_Derived+16 |
46+
| escape.cpp:152:19:152:28 | ConvertToNonVirtualBase[Derived : Intermediate2] | no_Derived+12 | no_Derived+12 |
47+
| escape.cpp:152:30:152:31 | FieldAddress[i2] | no_Derived+16 | no_Derived+16 |
48+
| escape.cpp:155:17:155:30 | CopyValue | no_ssa_addrOf+0 | no_ssa_addrOf+0 |
49+
| escape.cpp:155:17:155:30 | Store | no_ssa_addrOf+0 | no_ssa_addrOf+0 |
50+
| escape.cpp:158:17:158:28 | CopyValue | no_ssa_refTo+0 | no_ssa_refTo+0 |
51+
| escape.cpp:158:17:158:28 | Store | no_ssa_refTo+0 | no_ssa_refTo+0 |
52+
| escape.cpp:161:19:161:42 | Convert | no_ssa_refToArrayElement+0 | no_ssa_refToArrayElement+0 |
53+
| escape.cpp:161:19:161:45 | CopyValue | no_ssa_refToArrayElement+20 | no_ssa_refToArrayElement+20 |
54+
| escape.cpp:161:19:161:45 | PointerAdd[4] | no_ssa_refToArrayElement+20 | no_ssa_refToArrayElement+20 |
55+
| escape.cpp:161:19:161:45 | Store | no_ssa_refToArrayElement+20 | no_ssa_refToArrayElement+20 |
56+
| escape.cpp:164:24:164:40 | CopyValue | no_ssa_refToArray+0 | no_ssa_refToArray+0 |
57+
| escape.cpp:164:24:164:40 | Store | no_ssa_refToArray+0 | no_ssa_refToArray+0 |
58+
| escape.cpp:167:19:167:28 | CopyValue | passByPtr+0 | passByPtr+0 |
59+
| escape.cpp:170:21:170:29 | CopyValue | passByRef+0 | passByRef+0 |
60+
| escape.cpp:173:22:173:38 | CopyValue | no_ssa_passByPtr+0 | no_ssa_passByPtr+0 |
61+
| escape.cpp:176:24:176:39 | CopyValue | no_ssa_passByRef+0 | no_ssa_passByRef+0 |
62+
| escape.cpp:179:22:179:42 | CopyValue | no_ssa_passByPtr_ret+0 | no_ssa_passByPtr_ret+0 |
63+
| escape.cpp:182:24:182:43 | CopyValue | no_ssa_passByRef_ret+0 | no_ssa_passByRef_ret+0 |
64+
| escape.cpp:185:30:185:40 | CopyValue | passByPtr2+0 | passByPtr2+0 |
65+
| escape.cpp:188:32:188:41 | CopyValue | passByRef2+0 | passByRef2+0 |
66+
| escape.cpp:191:30:191:42 | Call | none | passByPtr3+0 |
67+
| escape.cpp:191:44:191:54 | CopyValue | passByPtr3+0 | passByPtr3+0 |
68+
| escape.cpp:194:32:194:46 | Call | none | passByRef3+0 |
69+
| escape.cpp:194:32:194:59 | CopyValue | none | passByRef3+0 |
70+
| escape.cpp:194:48:194:57 | CopyValue | passByRef3+0 | passByRef3+0 |
71+
| escape.cpp:199:17:199:34 | CopyValue | no_ssa_passByPtr4+0 | no_ssa_passByPtr4+0 |
72+
| escape.cpp:199:37:199:54 | CopyValue | no_ssa_passByPtr5+0 | no_ssa_passByPtr5+0 |
73+
| escape.cpp:202:5:202:19 | Call | none | passByRef6+0 |
74+
| escape.cpp:202:5:202:32 | CopyValue | none | passByRef6+0 |
75+
| escape.cpp:202:21:202:30 | CopyValue | passByRef6+0 | passByRef6+0 |
76+
| escape.cpp:205:5:205:19 | Call | none | no_ssa_passByRef7+0 |
77+
| escape.cpp:205:5:205:39 | CopyValue | none | no_ssa_passByRef7+0 |
78+
| escape.cpp:205:21:205:37 | CopyValue | no_ssa_passByRef7+0 | no_ssa_passByRef7+0 |
79+
| escape.cpp:209:14:209:25 | Call | none | no_ssa_c+0 |
80+
| escape.cpp:217:14:217:16 | CopyValue | c2+0 | c2+0 |
81+
| escape.cpp:221:8:221:19 | Call | none | c3+0 |
82+
| escape.cpp:225:17:225:28 | Call | none | c4+0 |
83+
| escape.cpp:247:2:247:27 | Store | condEscape1+0 | condEscape1+0 |
84+
| escape.cpp:247:16:247:27 | CopyValue | condEscape1+0 | condEscape1+0 |
85+
| escape.cpp:249:9:249:34 | Store | condEscape2+0 | condEscape2+0 |
86+
| escape.cpp:249:23:249:34 | CopyValue | condEscape2+0 | condEscape2+0 |

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import semmle.code.cpp.ir.implementation.raw.IR as Raw
44
import semmle.code.cpp.ir.implementation.aliased_ssa.internal.AliasAnalysis as UnAA
55
import semmle.code.cpp.ir.implementation.unaliased_ssa.IR as Un
66
import semmle.code.cpp.ir.implementation.unaliased_ssa.internal.SSAConstruction
7+
import semmle.code.cpp.ir.internal.IntegerConstant
78

89
from Raw::Instruction rawInstr, Un::Instruction unInstr, string rawPointsTo, string unPointsTo
910
where
@@ -12,21 +13,21 @@ where
1213
(
1314
exists(Variable var, int rawBitOffset, int unBitOffset |
1415
RawAA::resultPointsTo(rawInstr, Raw::getIRUserVariable(_, var), rawBitOffset) and
15-
rawPointsTo = var.toString() + RawAA::getBitOffsetString(rawBitOffset) and
16+
rawPointsTo = var.toString() + getBitOffsetString(rawBitOffset) and
1617
UnAA::resultPointsTo(unInstr, Un::getIRUserVariable(_, var), unBitOffset) and
17-
unPointsTo = var.toString() + UnAA::getBitOffsetString(unBitOffset)
18+
unPointsTo = var.toString() + getBitOffsetString(unBitOffset)
1819
)
1920
or
2021
exists(Variable var, int unBitOffset |
2122
not RawAA::resultPointsTo(rawInstr, Raw::getIRUserVariable(_, var), _) and
2223
rawPointsTo = "none" and
2324
UnAA::resultPointsTo(unInstr, Un::getIRUserVariable(_, var), unBitOffset) and
24-
unPointsTo = var.toString() + UnAA::getBitOffsetString(unBitOffset)
25+
unPointsTo = var.toString() + getBitOffsetString(unBitOffset)
2526
)
2627
or
2728
exists(Variable var, int rawBitOffset |
2829
RawAA::resultPointsTo(rawInstr, Raw::getIRUserVariable(_, var), rawBitOffset) and
29-
rawPointsTo = var.toString() + RawAA::getBitOffsetString(rawBitOffset) and
30+
rawPointsTo = var.toString() + getBitOffsetString(rawBitOffset) and
3031
not UnAA::resultPointsTo(unInstr, Un::getIRUserVariable(_, var), _) and
3132
unPointsTo = "none"
3233
)

0 commit comments

Comments
 (0)