@@ -450,7 +450,7 @@ let check_alloc_bounds loc ~ptr ub_unspec =
450
450
let @ model = model () in
451
451
let ub = CF.Undefined. (UB_CERB004_unspecified ub_unspec) in
452
452
fail (fun ctxt ->
453
- { loc; msg = Alloc_out_of_bounds { constr; ptr; ub; ctxt; model } }))
453
+ { loc; msg = Alloc_out_of_bounds { constr; term = ptr; ub; ctxt; model } }))
454
454
else
455
455
return ()
456
456
@@ -473,7 +473,7 @@ let check_both_eq_alloc loc arg1 arg2 ub =
473
473
| `True -> return ()
474
474
475
475
476
- let check_live_alloc_bounds reason loc arg ub constr =
476
+ let check_live_alloc_bounds reason loc arg ub term constr =
477
477
let @ base_size = RI.Special. get_live_alloc reason loc arg in
478
478
let here = Locations. other __FUNCTION__ in
479
479
let base, size = Alloc.History. get_base_size base_size here in
@@ -484,7 +484,8 @@ let check_live_alloc_bounds reason loc arg ub constr =
484
484
| `True -> return ()
485
485
| `False ->
486
486
let @ model = model () in
487
- fail (fun ctxt -> { loc; msg = Undefined_behaviour { ub; ctxt; model } }))
487
+ fail (fun ctxt ->
488
+ { loc; msg = Alloc_out_of_bounds { term; constr; ub; ctxt; model } }))
488
489
else
489
490
return ()
490
491
@@ -1382,7 +1383,13 @@ let rec check_expr labels (e : BT.t Mu.expr) (k : IT.t -> unit m) : unit m =
1382
1383
check_pexpr pe2 (fun arg2 ->
1383
1384
let @ () = check_both_eq_alloc loc arg1 arg2 ub in
1384
1385
let @ () =
1385
- check_live_alloc_bounds `Ptr_cmp loc arg1 ub (both_in_bounds arg1 arg2)
1386
+ check_live_alloc_bounds
1387
+ `Ptr_cmp
1388
+ loc
1389
+ arg1
1390
+ ub
1391
+ (IT. tuple_ [ arg1; arg2 ] here)
1392
+ (both_in_bounds arg1 arg2)
1386
1393
in
1387
1394
k (op (arg1, arg2))))
1388
1395
in
@@ -1411,7 +1418,13 @@ let rec check_expr labels (e : BT.t Mu.expr) (k : IT.t -> unit m) : unit m =
1411
1418
let ub_unspec = CF.Undefined. UB_unspec_pointer_sub in
1412
1419
let ub = CF.Undefined. (UB_CERB004_unspecified ub_unspec) in
1413
1420
let @ () =
1414
- check_live_alloc_bounds `Ptr_diff loc arg1 ub (both_in_bounds arg1 arg2)
1421
+ check_live_alloc_bounds
1422
+ `Ptr_diff
1423
+ loc
1424
+ arg1
1425
+ ub
1426
+ (IT. tuple_ [ arg1; arg2 ] here)
1427
+ (both_in_bounds arg1 arg2)
1415
1428
in
1416
1429
let ptr_diff_bt = Memory. bt_of_sct (Integer Ptrdiff_t ) in
1417
1430
let value =
@@ -1510,11 +1523,17 @@ let rec check_expr labels (e : BT.t Mu.expr) (k : IT.t -> unit m) : unit m =
1510
1523
let @ () = check_has_alloc_id loc vt1 ub_unspec in
1511
1524
let here = Locations. other __FUNCTION__ in
1512
1525
let @ () =
1513
- check_live_alloc_bounds `ISO_array_shift loc vt1 ub (fun ~base ~size ->
1514
- let addr = addr_ result here in
1515
- let lower = le_ (base, addr) here in
1516
- let upper = le_ (addr, add_ (base, size) here) here in
1517
- and_ [ lower; upper ] here)
1526
+ check_live_alloc_bounds
1527
+ `ISO_array_shift
1528
+ loc
1529
+ vt1
1530
+ ub
1531
+ result
1532
+ (fun ~base ~size ->
1533
+ let addr = addr_ result here in
1534
+ let lower = le_ (base, addr) here in
1535
+ let upper = le_ (addr, add_ (base, size) here) here in
1536
+ and_ [ lower; upper ] here)
1518
1537
in
1519
1538
k result))
1520
1539
| PtrMemberShift (_tag_sym , _memb_ident , _pe ) ->
@@ -1535,7 +1554,7 @@ let rec check_expr labels (e : BT.t Mu.expr) (k : IT.t -> unit m) : unit m =
1535
1554
let @ () = check_has_alloc_id loc vt2 ub_unspec in
1536
1555
let ub = CF.Undefined. (UB_CERB004_unspecified ub_unspec) in
1537
1556
let @ () =
1538
- check_live_alloc_bounds `Copy_alloc_id loc vt2 ub (fun ~base ~size ->
1557
+ check_live_alloc_bounds `Copy_alloc_id loc vt2 ub vt1 (fun ~base ~size ->
1539
1558
let addr = vt1 in
1540
1559
let lower = le_ (base, addr) here in
1541
1560
let upper = le_ (addr, add_ (base, size) here) here in
0 commit comments