Skip to content

Commit 2d9036e

Browse files
committed
C++: Make 'getInstructionConvertedResultExpression' equivalent in C and C++.
1 parent ebb7f28 commit 2d9036e

File tree

6 files changed

+198
-0
lines changed

6 files changed

+198
-0
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,23 @@ module Raw {
171171
// forwarded the result of another translated expression.
172172
instruction = translatedExpr.getInstruction(_)
173173
)
174+
or
175+
// Consider the snippet `if(x) { ... }` where `x` is an integer.
176+
// In C++ there is a `BoolConversion` conversion on `x` which generates a
177+
// `CompareNEInstruction` whose `getInstructionConvertedResultExpression`
178+
// is the `BoolConversion` (by the logic in the disjunct above). Thus,
179+
// calling `getInstructionUnconvertedResultExpression` on the
180+
// `CompareNEInstruction` gives `x` in C++ code.
181+
// However, in C there is no such conversion to return. So instead we have
182+
// to map the result of `getInstructionConvertedResultExpression` on the
183+
// `CompareNEInstruction` to `x` manually. This ensures that calling
184+
// `getInstructionUnconvertedResultExpression` on the `CompareNEInstruction`
185+
// gives `x` in both the C case and C++ case.
186+
exists(TranslatedValueCondition translatedValueCondition |
187+
translatedValueCondition = getTranslatedCondition(result) and
188+
translatedValueCondition.shouldGenerateCompareNE() and
189+
instruction = translatedValueCondition.getInstruction(ValueConditionCompareTag())
190+
)
174191
}
175192

176193
cached

cpp/ql/test/library-tests/controlflow/guards-ir/tests.expected

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,21 @@ astGuards
2020
| test.c:109:9:109:14 | ... == ... |
2121
| test.c:109:9:109:23 | ... \|\| ... |
2222
| test.c:109:19:109:23 | ... < ... |
23+
| test.c:126:7:126:7 | 1 |
24+
| test.c:126:7:126:28 | ... && ... |
25+
| test.c:126:12:126:26 | call to test3_condition |
26+
| test.c:131:7:131:7 | b |
27+
| test.c:137:7:137:7 | 0 |
2328
| test.c:146:7:146:8 | ! ... |
29+
| test.c:152:10:152:10 | x |
30+
| test.c:152:10:152:15 | ... && ... |
31+
| test.c:152:15:152:15 | y |
2432
| test.c:156:9:156:19 | ... == ... |
2533
| test.c:159:9:159:19 | ... == ... |
2634
| test.c:162:9:162:18 | ... < ... |
2735
| test.c:165:9:165:18 | ... < ... |
2836
| test.c:175:13:175:32 | ... == ... |
37+
| test.c:181:9:181:9 | x |
2938
| test.cpp:18:8:18:10 | call to get |
3039
| test.cpp:31:7:31:13 | ... == ... |
3140
| test.cpp:42:13:42:20 | call to getABool |
@@ -232,12 +241,44 @@ astGuardsCompare
232241
| 109 | y < 0+0 when ... < ... is true |
233242
| 109 | y >= 0+0 when ... < ... is false |
234243
| 109 | y >= 0+0 when ... \|\| ... is false |
244+
| 126 | 1 != 0 when 1 is true |
245+
| 126 | 1 != 0 when ... && ... is true |
246+
| 126 | 1 != 1 when 1 is false |
247+
| 126 | 1 == 0 when 1 is false |
248+
| 126 | 1 == 1 when 1 is true |
249+
| 126 | 1 == 1 when ... && ... is true |
250+
| 126 | call to test3_condition != 0 when ... && ... is true |
251+
| 126 | call to test3_condition != 0 when call to test3_condition is true |
252+
| 126 | call to test3_condition != 1 when call to test3_condition is false |
253+
| 126 | call to test3_condition == 0 when call to test3_condition is false |
254+
| 126 | call to test3_condition == 1 when ... && ... is true |
255+
| 126 | call to test3_condition == 1 when call to test3_condition is true |
256+
| 131 | b != 0 when b is true |
257+
| 131 | b != 1 when b is false |
258+
| 131 | b == 0 when b is false |
259+
| 131 | b == 1 when b is true |
260+
| 137 | 0 != 0 when 0 is true |
261+
| 137 | 0 != 1 when 0 is false |
262+
| 137 | 0 == 0 when 0 is false |
263+
| 137 | 0 == 1 when 0 is true |
235264
| 146 | ! ... != 0 when ! ... is true |
236265
| 146 | ! ... != 1 when ! ... is false |
237266
| 146 | ! ... == 0 when ! ... is false |
238267
| 146 | ! ... == 1 when ! ... is true |
239268
| 146 | x != 0 when ! ... is false |
240269
| 146 | x == 0 when ! ... is true |
270+
| 152 | x != 0 when ... && ... is true |
271+
| 152 | x != 0 when x is true |
272+
| 152 | x != 1 when x is false |
273+
| 152 | x == 0 when x is false |
274+
| 152 | x == 1 when ... && ... is true |
275+
| 152 | x == 1 when x is true |
276+
| 152 | y != 0 when ... && ... is true |
277+
| 152 | y != 0 when y is true |
278+
| 152 | y != 1 when y is false |
279+
| 152 | y == 0 when y is false |
280+
| 152 | y == 1 when ... && ... is true |
281+
| 152 | y == 1 when y is true |
241282
| 156 | ... + ... != x+0 when ... == ... is false |
242283
| 156 | ... + ... == x+0 when ... == ... is true |
243284
| 156 | ... == ... != 0 when ... == ... is true |
@@ -296,6 +337,10 @@ astGuardsCompare
296337
| 175 | call to foo != 0+0 when ... == ... is false |
297338
| 175 | call to foo == 0 when ... == ... is true |
298339
| 175 | call to foo == 0+0 when ... == ... is true |
340+
| 181 | x != 0 when x is true |
341+
| 181 | x != 1 when x is false |
342+
| 181 | x == 0 when x is false |
343+
| 181 | x == 1 when x is true |
299344
astGuardsControl
300345
| test.c:7:9:7:13 | ... > ... | false | 10 | 11 |
301346
| test.c:7:9:7:13 | ... > ... | true | 7 | 9 |
@@ -367,13 +412,29 @@ astGuardsControl
367412
| test.c:109:9:109:14 | ... == ... | false | 113 | 113 |
368413
| test.c:109:9:109:23 | ... \|\| ... | false | 113 | 113 |
369414
| test.c:109:19:109:23 | ... < ... | false | 113 | 113 |
415+
| test.c:126:7:126:7 | 1 | true | 126 | 126 |
416+
| test.c:126:7:126:7 | 1 | true | 126 | 128 |
417+
| test.c:126:7:126:7 | 1 | true | 131 | 131 |
418+
| test.c:126:7:126:7 | 1 | true | 131 | 132 |
419+
| test.c:126:7:126:7 | 1 | true | 134 | 123 |
420+
| test.c:126:7:126:28 | ... && ... | true | 126 | 128 |
421+
| test.c:126:12:126:26 | call to test3_condition | true | 126 | 128 |
422+
| test.c:131:7:131:7 | b | true | 131 | 132 |
423+
| test.c:137:7:137:7 | 0 | false | 142 | 136 |
370424
| test.c:146:7:146:8 | ! ... | true | 146 | 147 |
425+
| test.c:152:10:152:10 | x | true | 151 | 152 |
426+
| test.c:152:10:152:10 | x | true | 152 | 152 |
427+
| test.c:152:10:152:15 | ... && ... | true | 151 | 152 |
428+
| test.c:152:15:152:15 | y | true | 151 | 152 |
371429
| test.c:156:9:156:19 | ... == ... | true | 156 | 157 |
372430
| test.c:159:9:159:19 | ... == ... | true | 159 | 160 |
373431
| test.c:162:9:162:18 | ... < ... | true | 162 | 163 |
374432
| test.c:165:9:165:18 | ... < ... | true | 165 | 166 |
375433
| test.c:175:13:175:32 | ... == ... | false | 175 | 175 |
376434
| test.c:175:13:175:32 | ... == ... | true | 175 | 175 |
435+
| test.c:181:9:181:9 | x | false | 183 | 184 |
436+
| test.c:181:9:181:9 | x | true | 181 | 182 |
437+
| test.c:181:9:181:9 | x | true | 186 | 180 |
377438
| test.cpp:18:8:18:10 | call to get | true | 19 | 19 |
378439
| test.cpp:31:7:31:13 | ... == ... | false | 30 | 30 |
379440
| test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 |
@@ -753,9 +814,39 @@ astGuardsEnsure_const
753814
| test.c:109:9:109:23 | ... \|\| ... | test.c:109:19:109:23 | ... < ... | == | 0 | 113 | 113 |
754815
| test.c:109:19:109:23 | ... < ... | test.c:109:19:109:23 | ... < ... | != | 1 | 113 | 113 |
755816
| test.c:109:19:109:23 | ... < ... | test.c:109:19:109:23 | ... < ... | == | 0 | 113 | 113 |
817+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | != | 0 | 126 | 126 |
818+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | != | 0 | 126 | 128 |
819+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | != | 0 | 131 | 131 |
820+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | != | 0 | 131 | 132 |
821+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | != | 0 | 134 | 123 |
822+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | == | 1 | 126 | 126 |
823+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | == | 1 | 126 | 128 |
824+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | == | 1 | 131 | 131 |
825+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | == | 1 | 131 | 132 |
826+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | == | 1 | 134 | 123 |
827+
| test.c:126:7:126:28 | ... && ... | test.c:126:7:126:7 | 1 | != | 0 | 126 | 128 |
828+
| test.c:126:7:126:28 | ... && ... | test.c:126:7:126:7 | 1 | == | 1 | 126 | 128 |
829+
| test.c:126:7:126:28 | ... && ... | test.c:126:12:126:26 | call to test3_condition | != | 0 | 126 | 128 |
830+
| test.c:126:7:126:28 | ... && ... | test.c:126:12:126:26 | call to test3_condition | == | 1 | 126 | 128 |
831+
| test.c:126:12:126:26 | call to test3_condition | test.c:126:12:126:26 | call to test3_condition | != | 0 | 126 | 128 |
832+
| test.c:126:12:126:26 | call to test3_condition | test.c:126:12:126:26 | call to test3_condition | == | 1 | 126 | 128 |
833+
| test.c:131:7:131:7 | b | test.c:131:7:131:7 | b | != | 0 | 131 | 132 |
834+
| test.c:131:7:131:7 | b | test.c:131:7:131:7 | b | == | 1 | 131 | 132 |
835+
| test.c:137:7:137:7 | 0 | test.c:137:7:137:7 | 0 | != | 1 | 142 | 136 |
836+
| test.c:137:7:137:7 | 0 | test.c:137:7:137:7 | 0 | == | 0 | 142 | 136 |
756837
| test.c:146:7:146:8 | ! ... | test.c:146:7:146:8 | ! ... | != | 0 | 146 | 147 |
757838
| test.c:146:7:146:8 | ! ... | test.c:146:7:146:8 | ! ... | == | 1 | 146 | 147 |
758839
| test.c:146:7:146:8 | ! ... | test.c:146:8:146:8 | x | == | 0 | 146 | 147 |
840+
| test.c:152:10:152:10 | x | test.c:152:10:152:10 | x | != | 0 | 151 | 152 |
841+
| test.c:152:10:152:10 | x | test.c:152:10:152:10 | x | != | 0 | 152 | 152 |
842+
| test.c:152:10:152:10 | x | test.c:152:10:152:10 | x | == | 1 | 151 | 152 |
843+
| test.c:152:10:152:10 | x | test.c:152:10:152:10 | x | == | 1 | 152 | 152 |
844+
| test.c:152:10:152:15 | ... && ... | test.c:152:10:152:10 | x | != | 0 | 151 | 152 |
845+
| test.c:152:10:152:15 | ... && ... | test.c:152:10:152:10 | x | == | 1 | 151 | 152 |
846+
| test.c:152:10:152:15 | ... && ... | test.c:152:15:152:15 | y | != | 0 | 151 | 152 |
847+
| test.c:152:10:152:15 | ... && ... | test.c:152:15:152:15 | y | == | 1 | 151 | 152 |
848+
| test.c:152:15:152:15 | y | test.c:152:15:152:15 | y | != | 0 | 151 | 152 |
849+
| test.c:152:15:152:15 | y | test.c:152:15:152:15 | y | == | 1 | 151 | 152 |
759850
| test.c:156:9:156:19 | ... == ... | test.c:156:9:156:19 | ... == ... | != | 0 | 156 | 157 |
760851
| test.c:156:9:156:19 | ... == ... | test.c:156:9:156:19 | ... == ... | == | 1 | 156 | 157 |
761852
| test.c:159:9:159:19 | ... == ... | test.c:159:9:159:19 | ... == ... | != | 0 | 159 | 160 |
@@ -770,6 +861,12 @@ astGuardsEnsure_const
770861
| test.c:175:13:175:32 | ... == ... | test.c:175:13:175:32 | ... == ... | != | 1 | 175 | 175 |
771862
| test.c:175:13:175:32 | ... == ... | test.c:175:13:175:32 | ... == ... | == | 0 | 175 | 175 |
772863
| test.c:175:13:175:32 | ... == ... | test.c:175:13:175:32 | ... == ... | == | 1 | 175 | 175 |
864+
| test.c:181:9:181:9 | x | test.c:181:9:181:9 | x | != | 0 | 181 | 182 |
865+
| test.c:181:9:181:9 | x | test.c:181:9:181:9 | x | != | 0 | 186 | 180 |
866+
| test.c:181:9:181:9 | x | test.c:181:9:181:9 | x | != | 1 | 183 | 184 |
867+
| test.c:181:9:181:9 | x | test.c:181:9:181:9 | x | == | 0 | 183 | 184 |
868+
| test.c:181:9:181:9 | x | test.c:181:9:181:9 | x | == | 1 | 181 | 182 |
869+
| test.c:181:9:181:9 | x | test.c:181:9:181:9 | x | == | 1 | 186 | 180 |
773870
| test.cpp:18:8:18:10 | call to get | test.cpp:18:8:18:10 | call to get | != | 0 | 19 | 19 |
774871
| test.cpp:18:8:18:10 | call to get | test.cpp:18:8:18:10 | call to get | == | 1 | 19 | 19 |
775872
| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | -1 | 30 | 30 |
@@ -1012,23 +1109,35 @@ irGuardsCompare
10121109
| 109 | y >= 0 when CompareLT: ... < ... is false |
10131110
| 109 | y >= 0+0 when CompareLT: ... < ... is false |
10141111
| 126 | 1 != 0 when CompareNE: 1 is true |
1112+
| 126 | 1 != 1 when CompareNE: 1 is false |
10151113
| 126 | 1 == 0 when CompareNE: 1 is false |
1114+
| 126 | 1 == 1 when CompareNE: 1 is true |
10161115
| 126 | call to test3_condition != 0 when CompareNE: call to test3_condition is true |
1116+
| 126 | call to test3_condition != 1 when CompareNE: call to test3_condition is false |
10171117
| 126 | call to test3_condition == 0 when CompareNE: call to test3_condition is false |
1118+
| 126 | call to test3_condition == 1 when CompareNE: call to test3_condition is true |
10181119
| 131 | b != 0 when CompareNE: b is true |
1120+
| 131 | b != 1 when CompareNE: b is false |
10191121
| 131 | b == 0 when CompareNE: b is false |
1122+
| 131 | b == 1 when CompareNE: b is true |
10201123
| 137 | 0 != 0 when CompareNE: 0 is true |
1124+
| 137 | 0 != 1 when CompareNE: 0 is false |
10211125
| 137 | 0 == 0 when CompareNE: 0 is false |
1126+
| 137 | 0 == 1 when CompareNE: 0 is true |
10221127
| 146 | ! ... != 0 when CompareEQ: ! ... is true |
10231128
| 146 | ! ... != 1 when CompareEQ: ! ... is false |
10241129
| 146 | ! ... == 0 when CompareEQ: ! ... is false |
10251130
| 146 | ! ... == 1 when CompareEQ: ! ... is true |
10261131
| 146 | x != 0 when CompareEQ: ! ... is false |
10271132
| 146 | x == 0 when CompareEQ: ! ... is true |
10281133
| 152 | x != 0 when CompareNE: x is true |
1134+
| 152 | x != 1 when CompareNE: x is false |
10291135
| 152 | x == 0 when CompareNE: x is false |
1136+
| 152 | x == 1 when CompareNE: x is true |
10301137
| 152 | y != 0 when CompareNE: y is true |
1138+
| 152 | y != 1 when CompareNE: y is false |
10311139
| 152 | y == 0 when CompareNE: y is false |
1140+
| 152 | y == 1 when CompareNE: y is true |
10321141
| 156 | ... + ... != x+0 when CompareEQ: ... == ... is false |
10331142
| 156 | ... + ... == x+0 when CompareEQ: ... == ... is true |
10341143
| 156 | ... == ... != 0 when CompareEQ: ... == ... is true |
@@ -1088,7 +1197,9 @@ irGuardsCompare
10881197
| 175 | call to foo == 0 when CompareEQ: ... == ... is true |
10891198
| 175 | call to foo == 0+0 when CompareEQ: ... == ... is true |
10901199
| 181 | x != 0 when CompareNE: x is true |
1200+
| 181 | x != 1 when CompareNE: x is false |
10911201
| 181 | x == 0 when CompareNE: x is false |
1202+
| 181 | x == 1 when CompareNE: x is true |
10921203
irGuardsControl
10931204
| test.c:7:9:7:13 | CompareGT: ... > ... | false | 11 | 11 |
10941205
| test.c:7:9:7:13 | CompareGT: ... > ... | true | 8 | 8 |

cpp/ql/test/library-tests/controlflow/guards/Guards.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,15 @@
1919
| test.c:109:9:109:14 | ... == ... |
2020
| test.c:109:9:109:23 | ... \|\| ... |
2121
| test.c:109:19:109:23 | ... < ... |
22+
| test.c:126:7:126:7 | 1 |
23+
| test.c:126:7:126:28 | ... && ... |
24+
| test.c:126:12:126:26 | call to test3_condition |
25+
| test.c:131:7:131:7 | b |
26+
| test.c:137:7:137:7 | 0 |
2227
| test.c:146:7:146:8 | ! ... |
28+
| test.c:152:8:152:8 | p |
2329
| test.c:158:8:158:9 | ! ... |
30+
| test.c:164:8:164:8 | s |
2431
| test.c:170:8:170:9 | ! ... |
2532
| test.cpp:18:8:18:10 | call to get |
2633
| test.cpp:31:7:31:13 | ... == ... |

cpp/ql/test/library-tests/controlflow/guards/GuardsCompare.expected

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,29 @@
273273
| 125 | call to safe == 0 when call to safe is false |
274274
| 125 | call to safe == 1 when ! ... is false |
275275
| 125 | call to safe == 1 when call to safe is true |
276+
| 126 | 1 != 0 when 1 is true |
277+
| 126 | 1 != 0 when ... && ... is true |
278+
| 126 | 1 != 1 when 1 is false |
279+
| 126 | 1 == 0 when 1 is false |
280+
| 126 | 1 == 1 when 1 is true |
281+
| 126 | 1 == 1 when ... && ... is true |
282+
| 126 | call to test3_condition != 0 when ... && ... is true |
283+
| 126 | call to test3_condition != 0 when call to test3_condition is true |
284+
| 126 | call to test3_condition != 1 when call to test3_condition is false |
285+
| 126 | call to test3_condition == 0 when call to test3_condition is false |
286+
| 126 | call to test3_condition == 1 when ... && ... is true |
287+
| 126 | call to test3_condition == 1 when call to test3_condition is true |
276288
| 131 | ... + ... != a+0 when call to __builtin_expect is false |
277289
| 131 | ... + ... == a+0 when call to __builtin_expect is true |
278290
| 131 | a != ... + ...+0 when call to __builtin_expect is false |
279291
| 131 | a != b+42 when call to __builtin_expect is false |
280292
| 131 | a == ... + ...+0 when call to __builtin_expect is true |
281293
| 131 | a == b+42 when call to __builtin_expect is true |
294+
| 131 | b != 0 when b is true |
295+
| 131 | b != 1 when b is false |
282296
| 131 | b != a+-42 when call to __builtin_expect is false |
297+
| 131 | b == 0 when b is false |
298+
| 131 | b == 1 when b is true |
283299
| 131 | b == a+-42 when call to __builtin_expect is true |
284300
| 131 | call to __builtin_expect != 0 when call to __builtin_expect is true |
285301
| 131 | call to __builtin_expect != 1 when call to __builtin_expect is false |
@@ -297,6 +313,10 @@
297313
| 135 | call to __builtin_expect != 1 when call to __builtin_expect is false |
298314
| 135 | call to __builtin_expect == 0 when call to __builtin_expect is false |
299315
| 135 | call to __builtin_expect == 1 when call to __builtin_expect is true |
316+
| 137 | 0 != 0 when 0 is true |
317+
| 137 | 0 != 1 when 0 is false |
318+
| 137 | 0 == 0 when 0 is false |
319+
| 137 | 0 == 1 when 0 is true |
300320
| 141 | 42 != a+0 when call to __builtin_expect is false |
301321
| 141 | 42 == a+0 when call to __builtin_expect is true |
302322
| 141 | a != 42 when call to __builtin_expect is false |
@@ -323,12 +343,20 @@
323343
| 146 | ! ... == 1 when ! ... is true |
324344
| 146 | x != 0 when ! ... is false |
325345
| 146 | x == 0 when ! ... is true |
346+
| 152 | p != 0 when p is true |
347+
| 152 | p != 1 when p is false |
348+
| 152 | p == 0 when p is false |
349+
| 152 | p == 1 when p is true |
326350
| 158 | ! ... != 0 when ! ... is true |
327351
| 158 | ! ... != 1 when ! ... is false |
328352
| 158 | ! ... == 0 when ! ... is false |
329353
| 158 | ! ... == 1 when ! ... is true |
330354
| 158 | p != 0 when ! ... is false |
331355
| 158 | p == 0 when ! ... is true |
356+
| 164 | s != 0 when s is true |
357+
| 164 | s != 1 when s is false |
358+
| 164 | s == 0 when s is false |
359+
| 164 | s == 1 when s is true |
332360
| 170 | ! ... != 0 when ! ... is true |
333361
| 170 | ! ... != 1 when ! ... is false |
334362
| 170 | ! ... == 0 when ! ... is false |

cpp/ql/test/library-tests/controlflow/guards/GuardsControl.expected

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,19 @@
6868
| test.c:109:9:109:14 | ... == ... | false | 113 | 113 |
6969
| test.c:109:9:109:23 | ... \|\| ... | false | 113 | 113 |
7070
| test.c:109:19:109:23 | ... < ... | false | 113 | 113 |
71+
| test.c:126:7:126:7 | 1 | true | 126 | 126 |
72+
| test.c:126:7:126:7 | 1 | true | 126 | 128 |
73+
| test.c:126:7:126:7 | 1 | true | 131 | 131 |
74+
| test.c:126:7:126:7 | 1 | true | 131 | 132 |
75+
| test.c:126:7:126:7 | 1 | true | 134 | 123 |
76+
| test.c:126:7:126:28 | ... && ... | true | 126 | 128 |
77+
| test.c:126:12:126:26 | call to test3_condition | true | 126 | 128 |
78+
| test.c:131:7:131:7 | b | true | 131 | 132 |
79+
| test.c:137:7:137:7 | 0 | false | 142 | 136 |
7180
| test.c:146:7:146:8 | ! ... | true | 146 | 147 |
81+
| test.c:152:8:152:8 | p | true | 152 | 154 |
7282
| test.c:158:8:158:9 | ! ... | true | 158 | 160 |
83+
| test.c:164:8:164:8 | s | true | 164 | 166 |
7384
| test.c:170:8:170:9 | ! ... | true | 170 | 172 |
7485
| test.cpp:18:8:18:10 | call to get | true | 19 | 19 |
7586
| test.cpp:31:7:31:13 | ... == ... | false | 30 | 30 |

cpp/ql/test/library-tests/controlflow/guards/GuardsEnsure.expected

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,12 +419,36 @@ unary
419419
| test.c:109:19:109:23 | ... < ... | test.c:109:19:109:19 | y | >= | 0 | 113 | 113 |
420420
| test.c:109:19:109:23 | ... < ... | test.c:109:19:109:23 | ... < ... | != | 1 | 113 | 113 |
421421
| test.c:109:19:109:23 | ... < ... | test.c:109:19:109:23 | ... < ... | == | 0 | 113 | 113 |
422+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | != | 0 | 126 | 126 |
423+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | != | 0 | 126 | 128 |
424+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | != | 0 | 131 | 131 |
425+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | != | 0 | 131 | 132 |
426+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | != | 0 | 134 | 123 |
427+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | == | 1 | 126 | 126 |
428+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | == | 1 | 126 | 128 |
429+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | == | 1 | 131 | 131 |
430+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | == | 1 | 131 | 132 |
431+
| test.c:126:7:126:7 | 1 | test.c:126:7:126:7 | 1 | == | 1 | 134 | 123 |
432+
| test.c:126:7:126:28 | ... && ... | test.c:126:7:126:7 | 1 | != | 0 | 126 | 128 |
433+
| test.c:126:7:126:28 | ... && ... | test.c:126:7:126:7 | 1 | == | 1 | 126 | 128 |
434+
| test.c:126:7:126:28 | ... && ... | test.c:126:12:126:26 | call to test3_condition | != | 0 | 126 | 128 |
435+
| test.c:126:7:126:28 | ... && ... | test.c:126:12:126:26 | call to test3_condition | == | 1 | 126 | 128 |
436+
| test.c:126:12:126:26 | call to test3_condition | test.c:126:12:126:26 | call to test3_condition | != | 0 | 126 | 128 |
437+
| test.c:126:12:126:26 | call to test3_condition | test.c:126:12:126:26 | call to test3_condition | == | 1 | 126 | 128 |
438+
| test.c:131:7:131:7 | b | test.c:131:7:131:7 | b | != | 0 | 131 | 132 |
439+
| test.c:131:7:131:7 | b | test.c:131:7:131:7 | b | == | 1 | 131 | 132 |
440+
| test.c:137:7:137:7 | 0 | test.c:137:7:137:7 | 0 | != | 1 | 142 | 136 |
441+
| test.c:137:7:137:7 | 0 | test.c:137:7:137:7 | 0 | == | 0 | 142 | 136 |
422442
| test.c:146:7:146:8 | ! ... | test.c:146:7:146:8 | ! ... | != | 0 | 146 | 147 |
423443
| test.c:146:7:146:8 | ! ... | test.c:146:7:146:8 | ! ... | == | 1 | 146 | 147 |
424444
| test.c:146:7:146:8 | ! ... | test.c:146:8:146:8 | x | == | 0 | 146 | 147 |
445+
| test.c:152:8:152:8 | p | test.c:152:8:152:8 | p | != | 0 | 152 | 154 |
446+
| test.c:152:8:152:8 | p | test.c:152:8:152:8 | p | == | 1 | 152 | 154 |
425447
| test.c:158:8:158:9 | ! ... | test.c:158:8:158:9 | ! ... | != | 0 | 158 | 160 |
426448
| test.c:158:8:158:9 | ! ... | test.c:158:8:158:9 | ! ... | == | 1 | 158 | 160 |
427449
| test.c:158:8:158:9 | ! ... | test.c:158:9:158:9 | p | == | 0 | 158 | 160 |
450+
| test.c:164:8:164:8 | s | test.c:164:8:164:8 | s | != | 0 | 164 | 166 |
451+
| test.c:164:8:164:8 | s | test.c:164:8:164:8 | s | == | 1 | 164 | 166 |
428452
| test.c:170:8:170:9 | ! ... | test.c:170:8:170:9 | ! ... | != | 0 | 170 | 172 |
429453
| test.c:170:8:170:9 | ! ... | test.c:170:8:170:9 | ! ... | == | 1 | 170 | 172 |
430454
| test.c:170:8:170:9 | ! ... | test.c:170:9:170:9 | s | == | 0 | 170 | 172 |

0 commit comments

Comments
 (0)