@@ -237,6 +237,7 @@ class goto_check_ct
237
237
// / \param asserted_expr: expression to be asserted
238
238
// / \param comment: human readable comment
239
239
// / \param property_class: classification of the property
240
+ // / \param is_fatal: property checks for undefined behavior
240
241
// / \param source_location: the source location of the original expression
241
242
// / \param src_expr: the original expression to be included in the comment
242
243
// / \param guard: the condition under which the asserted expression should be
@@ -245,6 +246,7 @@ class goto_check_ct
245
246
const exprt &asserted_expr,
246
247
const std::string &comment,
247
248
const std::string &property_class,
249
+ bool is_fatal,
248
250
const source_locationt &source_location,
249
251
const exprt &src_expr,
250
252
const guardt &guard);
@@ -507,6 +509,7 @@ void goto_check_ct::div_by_zero_check(
507
509
inequality,
508
510
" division by zero" ,
509
511
" division-by-zero" ,
512
+ true , // fatal
510
513
expr.find_source_location (),
511
514
expr,
512
515
guard);
@@ -528,6 +531,7 @@ void goto_check_ct::float_div_by_zero_check(
528
531
inequality,
529
532
" floating-point division by zero" ,
530
533
" float-division-by-zero" ,
534
+ false , // fatal
531
535
expr.find_source_location (),
532
536
expr,
533
537
guard);
@@ -552,6 +556,7 @@ void goto_check_ct::enum_range_check(const exprt &expr, const guardt &guard)
552
556
check,
553
557
" enum range check" ,
554
558
" enum-range-check" ,
559
+ false , // fatal
555
560
expr.find_source_location (),
556
561
expr,
557
562
guard);
@@ -578,6 +583,7 @@ void goto_check_ct::undefined_shift_check(
578
583
inequality,
579
584
" shift distance is negative" ,
580
585
" undefined-shift" ,
586
+ false , // fatal
581
587
expr.find_source_location (),
582
588
expr,
583
589
guard);
@@ -594,6 +600,7 @@ void goto_check_ct::undefined_shift_check(
594
600
binary_relation_exprt (expr.distance (), ID_lt, std::move (width_expr)),
595
601
" shift distance too large" ,
596
602
" undefined-shift" ,
603
+ false , // fatal
597
604
expr.find_source_location (),
598
605
expr,
599
606
guard);
@@ -607,6 +614,7 @@ void goto_check_ct::undefined_shift_check(
607
614
inequality,
608
615
" shift operand is negative" ,
609
616
" undefined-shift" ,
617
+ false , // fatal
610
618
expr.find_source_location (),
611
619
expr,
612
620
guard);
@@ -618,6 +626,7 @@ void goto_check_ct::undefined_shift_check(
618
626
false_exprt (),
619
627
" shift of non-integer type" ,
620
628
" undefined-shift" ,
629
+ false , // fatal
621
630
expr.find_source_location (),
622
631
expr,
623
632
guard);
@@ -640,6 +649,7 @@ void goto_check_ct::mod_by_zero_check(
640
649
inequality,
641
650
" division by zero" ,
642
651
" division-by-zero" ,
652
+ false , // fatal
643
653
expr.find_source_location (),
644
654
expr,
645
655
guard);
@@ -672,6 +682,7 @@ void goto_check_ct::mod_overflow_check(
672
682
or_exprt (int_min_neq, minus_one_neq),
673
683
" result of signed mod is not representable" ,
674
684
" overflow" ,
685
+ false , // fatal
675
686
expr.find_source_location (),
676
687
expr,
677
688
guard);
@@ -716,6 +727,7 @@ void goto_check_ct::conversion_check(const exprt &expr, const guardt &guard)
716
727
and_exprt (no_overflow_lower, no_overflow_upper),
717
728
" arithmetic overflow on signed type conversion" ,
718
729
" overflow" ,
730
+ false , // fatal
719
731
expr.find_source_location (),
720
732
expr,
721
733
guard);
@@ -733,6 +745,7 @@ void goto_check_ct::conversion_check(const exprt &expr, const guardt &guard)
733
745
no_overflow_upper,
734
746
" arithmetic overflow on unsigned to signed type conversion" ,
735
747
" overflow" ,
748
+ false , // fatal
736
749
expr.find_source_location (),
737
750
expr,
738
751
guard);
@@ -754,6 +767,7 @@ void goto_check_ct::conversion_check(const exprt &expr, const guardt &guard)
754
767
and_exprt (no_overflow_lower, no_overflow_upper),
755
768
" arithmetic overflow on float to signed integer type conversion" ,
756
769
" overflow" ,
770
+ false , // fatal
757
771
expr.find_source_location (),
758
772
expr,
759
773
guard);
@@ -777,6 +791,7 @@ void goto_check_ct::conversion_check(const exprt &expr, const guardt &guard)
777
791
no_overflow_lower,
778
792
" arithmetic overflow on signed to unsigned type conversion" ,
779
793
" overflow" ,
794
+ false , // fatal
780
795
expr.find_source_location (),
781
796
expr,
782
797
guard);
@@ -794,6 +809,7 @@ void goto_check_ct::conversion_check(const exprt &expr, const guardt &guard)
794
809
and_exprt (no_overflow_lower, no_overflow_upper),
795
810
" arithmetic overflow on signed to unsigned type conversion" ,
796
811
" overflow" ,
812
+ false , // fatal
797
813
expr.find_source_location (),
798
814
expr,
799
815
guard);
@@ -812,6 +828,7 @@ void goto_check_ct::conversion_check(const exprt &expr, const guardt &guard)
812
828
no_overflow_upper,
813
829
" arithmetic overflow on unsigned to unsigned type conversion" ,
814
830
" overflow" ,
831
+ false , // fatal
815
832
expr.find_source_location (),
816
833
expr,
817
834
guard);
@@ -833,6 +850,7 @@ void goto_check_ct::conversion_check(const exprt &expr, const guardt &guard)
833
850
and_exprt (no_overflow_lower, no_overflow_upper),
834
851
" arithmetic overflow on float to unsigned integer type conversion" ,
835
852
" overflow" ,
853
+ false , // fatal
836
854
expr.find_source_location (),
837
855
expr,
838
856
guard);
@@ -875,6 +893,7 @@ void goto_check_ct::integer_overflow_check(
875
893
not_exprt (and_exprt (int_min_eq, minus_one_eq)),
876
894
" arithmetic overflow on signed division" ,
877
895
" overflow" ,
896
+ false , // fatal
878
897
expr.find_source_location (),
879
898
expr,
880
899
guard);
@@ -896,6 +915,7 @@ void goto_check_ct::integer_overflow_check(
896
915
not_exprt (int_min_eq),
897
916
" arithmetic overflow on signed unary minus" ,
898
917
" overflow" ,
918
+ false , // fatal
899
919
expr.find_source_location (),
900
920
expr,
901
921
guard);
@@ -912,6 +932,7 @@ void goto_check_ct::integer_overflow_check(
912
932
not_eq_zero,
913
933
" arithmetic overflow on unsigned unary minus" ,
914
934
" overflow" ,
935
+ false , // fatal
915
936
expr.find_source_location (),
916
937
expr,
917
938
guard);
@@ -1018,6 +1039,7 @@ void goto_check_ct::integer_overflow_check(
1018
1039
top_bits_zero}),
1019
1040
" arithmetic overflow on signed shl" ,
1020
1041
" overflow" ,
1042
+ false , // fatal
1021
1043
expr.find_source_location (),
1022
1044
expr,
1023
1045
guard);
@@ -1052,6 +1074,7 @@ void goto_check_ct::integer_overflow_check(
1052
1074
not_exprt{binary_overflow_exprt{tmp, expr.id (), expr.operands ()[i]}},
1053
1075
" arithmetic overflow on " + kind + " " + expr.id_string (),
1054
1076
" overflow" ,
1077
+ false , // fatal
1055
1078
expr.find_source_location (),
1056
1079
expr,
1057
1080
guard);
@@ -1066,6 +1089,7 @@ void goto_check_ct::integer_overflow_check(
1066
1089
not_exprt{binary_overflow_exprt{bexpr.lhs (), expr.id (), bexpr.rhs ()}},
1067
1090
" arithmetic overflow on " + kind + " " + expr.id_string (),
1068
1091
" overflow" ,
1092
+ false , // fatal
1069
1093
expr.find_source_location (),
1070
1094
expr,
1071
1095
guard);
@@ -1080,6 +1104,7 @@ void goto_check_ct::integer_overflow_check(
1080
1104
not_exprt{unary_minus_overflow_exprt{to_unary_expr (expr).op ()}},
1081
1105
" arithmetic overflow on " + kind + " " + expr.id_string (),
1082
1106
" overflow" ,
1107
+ false , // fatal
1083
1108
expr.find_source_location (),
1084
1109
expr,
1085
1110
guard);
@@ -1113,6 +1138,7 @@ void goto_check_ct::float_overflow_check(const exprt &expr, const guardt &guard)
1113
1138
std::move (overflow_check),
1114
1139
" arithmetic overflow on floating-point typecast" ,
1115
1140
" overflow" ,
1141
+ false , // fatal
1116
1142
expr.find_source_location (),
1117
1143
expr,
1118
1144
guard);
@@ -1124,6 +1150,7 @@ void goto_check_ct::float_overflow_check(const exprt &expr, const guardt &guard)
1124
1150
not_exprt (isinf_exprt (expr)),
1125
1151
" arithmetic overflow on floating-point typecast" ,
1126
1152
" overflow" ,
1153
+ false , // fatal
1127
1154
expr.find_source_location (),
1128
1155
expr,
1129
1156
guard);
@@ -1141,6 +1168,7 @@ void goto_check_ct::float_overflow_check(const exprt &expr, const guardt &guard)
1141
1168
std::move (overflow_check),
1142
1169
" arithmetic overflow on floating-point division" ,
1143
1170
" overflow" ,
1171
+ false , // fatal
1144
1172
expr.find_source_location (),
1145
1173
expr,
1146
1174
guard);
@@ -1176,6 +1204,7 @@ void goto_check_ct::float_overflow_check(const exprt &expr, const guardt &guard)
1176
1204
std::move (overflow_check),
1177
1205
" arithmetic overflow on floating-point " + kind,
1178
1206
" overflow" ,
1207
+ false , // fatal
1179
1208
expr.find_source_location (),
1180
1209
expr,
1181
1210
guard);
@@ -1296,6 +1325,7 @@ void goto_check_ct::nan_check(const exprt &expr, const guardt &guard)
1296
1325
boolean_negate (isnan),
1297
1326
" NaN on " + expr.id_string (),
1298
1327
" NaN" ,
1328
+ false , // fatal
1299
1329
expr.find_source_location (),
1300
1330
expr,
1301
1331
guard);
@@ -1320,6 +1350,7 @@ void goto_check_ct::pointer_rel_check(
1320
1350
same_object,
1321
1351
" same object violation" ,
1322
1352
" pointer" ,
1353
+ false , // fatal
1323
1354
expr.find_source_location (),
1324
1355
expr,
1325
1356
guard);
@@ -1337,6 +1368,7 @@ void goto_check_ct::pointer_rel_check(
1337
1368
c.assertion ,
1338
1369
" pointer relation: " + c.description ,
1339
1370
" pointer arithmetic" ,
1371
+ false , // fatal
1340
1372
expr.find_source_location (),
1341
1373
pointer,
1342
1374
guard);
@@ -1395,6 +1427,7 @@ void goto_check_ct::pointer_overflow_check(
1395
1427
c.assertion ,
1396
1428
" pointer arithmetic: " + c.description ,
1397
1429
" pointer arithmetic" ,
1430
+ false , // fatal
1398
1431
expr.find_source_location (),
1399
1432
expr,
1400
1433
guard);
@@ -1436,6 +1469,7 @@ void goto_check_ct::pointer_validity_check(
1436
1469
c.assertion ,
1437
1470
" dereference failure: " + c.description ,
1438
1471
" pointer dereference" ,
1472
+ false , // fatal
1439
1473
src_expr.find_source_location (),
1440
1474
src_expr,
1441
1475
guard);
@@ -1477,6 +1511,7 @@ void goto_check_ct::pointer_primitive_check(
1477
1511
or_exprt{null_object (pointer), c.assertion },
1478
1512
c.description ,
1479
1513
" pointer primitives" ,
1514
+ false , // fatal
1480
1515
expr.source_location (),
1481
1516
expr,
1482
1517
guard);
@@ -1593,6 +1628,7 @@ void goto_check_ct::bounds_check_index(
1593
1628
inequality,
1594
1629
name + " lower bound" ,
1595
1630
" array bounds" ,
1631
+ false , // fatal
1596
1632
expr.find_source_location (),
1597
1633
expr,
1598
1634
guard);
@@ -1627,6 +1663,7 @@ void goto_check_ct::bounds_check_index(
1627
1663
precond,
1628
1664
name + " dynamic object upper bound" ,
1629
1665
" array bounds" ,
1666
+ false , // fatal
1630
1667
expr.find_source_location (),
1631
1668
expr,
1632
1669
guard);
@@ -1671,6 +1708,7 @@ void goto_check_ct::bounds_check_index(
1671
1708
inequality,
1672
1709
name + " upper bound" ,
1673
1710
" array bounds" ,
1711
+ false , // fatal
1674
1712
expr.find_source_location (),
1675
1713
expr,
1676
1714
guard);
@@ -1684,6 +1722,7 @@ void goto_check_ct::bounds_check_index(
1684
1722
inequality,
1685
1723
name + " upper bound" ,
1686
1724
" array bounds" ,
1725
+ false , // fatal
1687
1726
expr.find_source_location (),
1688
1727
expr,
1689
1728
guard);
@@ -1707,6 +1746,7 @@ void goto_check_ct::bounds_check_bit_count(
1707
1746
notequal_exprt{expr.op (), from_integer (0 , expr.op ().type ())},
1708
1747
" count " + name + " zeros is undefined for value zero" ,
1709
1748
" bit count" ,
1749
+ false , // fatal
1710
1750
expr.find_source_location (),
1711
1751
expr,
1712
1752
guard);
@@ -1716,6 +1756,7 @@ void goto_check_ct::add_guarded_property(
1716
1756
const exprt &asserted_expr,
1717
1757
const std::string &comment,
1718
1758
const std::string &property_class,
1759
+ bool is_fatal,
1719
1760
const source_locationt &source_location,
1720
1761
const exprt &src_expr,
1721
1762
const guardt &guard)
@@ -1749,7 +1790,7 @@ void goto_check_ct::add_guarded_property(
1749
1790
}
1750
1791
else
1751
1792
{
1752
- if (property_class == " division-by-zero " )
1793
+ if (is_fatal )
1753
1794
annotated_location.property_fatal (true );
1754
1795
1755
1796
new_code.add (goto_programt::make_assertion (
@@ -2040,6 +2081,7 @@ void goto_check_ct::memory_leak_check(const irep_idt &function_id)
2040
2081
eq,
2041
2082
" dynamically allocated memory never freed" ,
2042
2083
" memory-leak" ,
2084
+ false , // fatal
2043
2085
source_location,
2044
2086
eq,
2045
2087
identity);
0 commit comments