diff --git a/cpp/ql/test/library-tests/dataflow/dataflow-tests/test-source-sink.expected b/cpp/ql/test/library-tests/dataflow/dataflow-tests/test-source-sink.expected index d9ac3c3dee5..03a106208a5 100644 --- a/cpp/ql/test/library-tests/dataflow/dataflow-tests/test-source-sink.expected +++ b/cpp/ql/test/library-tests/dataflow/dataflow-tests/test-source-sink.expected @@ -147,6 +147,29 @@ astFlow | test.cpp:1165:10:1165:15 | call to source | test.cpp:1239:10:1239:26 | * ... | | test.cpp:1195:10:1195:24 | call to indirect_source | test.cpp:1200:19:1200:36 | global_int_ptr_ptr | | test.cpp:1195:10:1195:24 | call to indirect_source | test.cpp:1201:10:1201:27 | global_int_ptr_ptr | +| test.cpp:1258:11:1258:16 | call to source | test.cpp:1259:8:1259:10 | ... ++ | +| test.cpp:1262:7:1262:12 | call to source | test.cpp:1263:8:1263:10 | ... -- | +| test.cpp:1266:7:1266:12 | call to source | test.cpp:1267:8:1267:10 | ++ ... | +| test.cpp:1266:7:1266:12 | call to source | test.cpp:1268:8:1268:8 | x | +| test.cpp:1270:7:1270:12 | call to source | test.cpp:1271:8:1271:10 | -- ... | +| test.cpp:1270:7:1270:12 | call to source | test.cpp:1272:8:1272:8 | x | +| test.cpp:1274:7:1274:12 | call to source | test.cpp:1275:8:1275:14 | ... += ... | +| test.cpp:1274:7:1274:12 | call to source | test.cpp:1276:8:1276:8 | x | +| test.cpp:1278:7:1278:12 | call to source | test.cpp:1279:8:1279:14 | ... -= ... | +| test.cpp:1278:7:1278:12 | call to source | test.cpp:1280:8:1280:8 | x | +| test.cpp:1284:11:1284:16 | call to source | test.cpp:1285:8:1285:20 | ... ? ... : ... | +| test.cpp:1288:7:1288:12 | call to source | test.cpp:1289:8:1289:20 | ... ++ | +| test.cpp:1288:7:1288:12 | call to source | test.cpp:1290:8:1290:8 | x | +| test.cpp:1292:7:1292:12 | call to source | test.cpp:1294:8:1294:8 | x | +| test.cpp:1296:7:1296:12 | call to source | test.cpp:1297:8:1297:18 | ... ? ... : ... | +| test.cpp:1296:7:1296:12 | call to source | test.cpp:1298:8:1298:8 | x | +| test.cpp:1300:7:1300:12 | call to source | test.cpp:1301:8:1301:18 | ... ? ... : ... | +| test.cpp:1300:7:1300:12 | call to source | test.cpp:1302:8:1302:8 | x | +| test.cpp:1304:7:1304:12 | call to source | test.cpp:1305:8:1305:18 | ... ? ... : ... | +| test.cpp:1304:7:1304:12 | call to source | test.cpp:1306:8:1306:8 | x | +| test.cpp:1308:7:1308:12 | call to source | test.cpp:1309:14:1309:16 | ... ++ | +| test.cpp:1312:7:1312:12 | call to source | test.cpp:1313:8:1313:24 | ... ? ... : ... | +| test.cpp:1312:7:1312:12 | call to source | test.cpp:1314:8:1314:8 | x | | true_upon_entry.cpp:17:11:17:16 | call to source | true_upon_entry.cpp:21:8:21:8 | x | | true_upon_entry.cpp:27:9:27:14 | call to source | true_upon_entry.cpp:29:8:29:8 | x | | true_upon_entry.cpp:33:11:33:16 | call to source | true_upon_entry.cpp:39:8:39:8 | x | @@ -354,6 +377,19 @@ irFlow | test.cpp:1195:10:1195:24 | *call to indirect_source | test.cpp:1218:19:1218:36 | **global_int_ptr_ptr | | test.cpp:1195:10:1195:24 | *call to indirect_source | test.cpp:1224:19:1224:37 | ** ... | | test.cpp:1195:10:1195:24 | *call to indirect_source | test.cpp:1227:10:1227:29 | * ... | +| test.cpp:1258:11:1258:16 | call to source | test.cpp:1259:8:1259:10 | ... ++ | +| test.cpp:1262:7:1262:12 | call to source | test.cpp:1263:8:1263:10 | ... -- | +| test.cpp:1284:11:1284:16 | call to source | test.cpp:1285:8:1285:20 | ... ? ... : ... | +| test.cpp:1288:7:1288:12 | call to source | test.cpp:1290:8:1290:8 | x | +| test.cpp:1292:7:1292:12 | call to source | test.cpp:1294:8:1294:8 | x | +| test.cpp:1296:7:1296:12 | call to source | test.cpp:1297:8:1297:18 | ... ? ... : ... | +| test.cpp:1296:7:1296:12 | call to source | test.cpp:1298:8:1298:8 | x | +| test.cpp:1300:7:1300:12 | call to source | test.cpp:1301:8:1301:18 | ... ? ... : ... | +| test.cpp:1300:7:1300:12 | call to source | test.cpp:1302:8:1302:8 | x | +| test.cpp:1304:7:1304:12 | call to source | test.cpp:1306:8:1306:8 | x | +| test.cpp:1308:7:1308:12 | call to source | test.cpp:1309:8:1309:16 | ... ++ | +| test.cpp:1312:7:1312:12 | call to source | test.cpp:1313:8:1313:24 | ... ? ... : ... | +| test.cpp:1312:7:1312:12 | call to source | test.cpp:1314:8:1314:8 | x | | true_upon_entry.cpp:9:11:9:16 | call to source | true_upon_entry.cpp:13:8:13:8 | x | | true_upon_entry.cpp:17:11:17:16 | call to source | true_upon_entry.cpp:21:8:21:8 | x | | true_upon_entry.cpp:27:9:27:14 | call to source | true_upon_entry.cpp:29:8:29:8 | x | diff --git a/cpp/ql/test/library-tests/dataflow/dataflow-tests/test.cpp b/cpp/ql/test/library-tests/dataflow/dataflow-tests/test.cpp index 35e6a074cfd..e1c3ef98fb7 100644 --- a/cpp/ql/test/library-tests/dataflow/dataflow-tests/test.cpp +++ b/cpp/ql/test/library-tests/dataflow/dataflow-tests/test.cpp @@ -1252,4 +1252,64 @@ namespace globals_without_explicit_def { calls_set_array(); sink(*global_int_array); // $ ir MISSING: ast } +} + +void crement_test1() { + int x = source(); + sink(x++); // $ ir ast + sink(x); + + x = source(); + sink(x--); // $ ir ast + sink(x); + + x = source(); + sink(++x); // $ SPURIOUS: ast + sink(x); // $ SPURIOUS: ast + + x = source(); + sink(--x); // $ SPURIOUS: ast + sink(x); // $ SPURIOUS: ast + + x = source(); + sink(x += 10); // $ SPURIOUS: ast + sink(x); // $ SPURIOUS: ast + + x = source(); + sink(x -= 10); // $ SPURIOUS: ast + sink(x); // $ SPURIOUS: ast +} + +void crement_test2(bool b, int y) { + int x = source(); + sink(b ? x++ : x--); // $ ir ast + sink(x); + + x = source(); + sink((b ? x : y)++); // $ ast MISSING: ir + sink(x); // $ ir ast + + x = source(); + sink(++(b ? x : y)); + sink(x); // $ ir ast + + x = source(); + sink(b ? x++ : y); // $ ir ast + sink(x); // $ ir ast + + x = source(); + sink(b ? x : y++); // $ ir ast + sink(x); // $ ir ast + + x = source(); + sink(b ? ++x : y); // $ SPURIOUS: ast + sink(x); // $ ir ast + + x = source(); + sink((long)x++); // $ ir ast + sink(x); + + x = source(); + sink(b ? (long)x++ : 0); // $ ir ast + sink(x); // $ ir ast } \ No newline at end of file