@@ -1420,6 +1420,7 @@ object (self)
14201420 let memref_r = self#env#mk_base_variable_reference base in
14211421 let memoff_r =
14221422 match offset with
1423+ | XConst (IntConst n ) when n#equal numerical_zero -> Ok NoOffset
14231424 | XConst (IntConst n ) -> Ok (ConstantOffset (n, NoOffset ))
14241425 | _ ->
14251426 Error [__FILE__ ^ " :" ^ (string_of_int __LINE__) ^ " : "
@@ -1497,6 +1498,7 @@ object (self)
14971498 let memref_r = self#env#mk_base_variable_reference base in
14981499 let memoff_r =
14991500 match offset with
1501+ | XConst (IntConst n ) when n#equal numerical_zero -> Ok NoOffset
15001502 | XConst (IntConst n ) -> Ok (ConstantOffset (n, NoOffset ))
15011503 | _ ->
15021504 Error [__FILE__ ^ " :" ^ (string_of_int __LINE__) ^ " : "
@@ -1704,7 +1706,24 @@ object (self)
17041706 __FILE__ __LINE__
17051707 [" x: " ^ (x2s x) ^ " ; exp: " ^ (x2s exp)] in
17061708 Ok exp in
1707- aux x
1709+ let result = aux x in
1710+ match result with
1711+ | Ok okresult ->
1712+ let _ =
1713+ log_diagnostics_result
1714+ ~msg: (p2s self#l#toPretty)
1715+ ~tag: " convert-xpr-offsets:result"
1716+ __FILE__ __LINE__
1717+ [" x: " ^ (x2s x) ^ " ; exp: " ^ (x2s okresult)] in
1718+ result
1719+ | Error e ->
1720+ let _ =
1721+ log_diagnostics_result
1722+ ~msg: (p2s self#l#toPretty)
1723+ ~tag: " convert-xpr-offsets:failure"
1724+ __FILE__ __LINE__
1725+ [" x: " ^ (x2s x) ^ " ; " ^ (String. concat " ; " e)] in
1726+ result
17081727
17091728 method get_xpr_type (x : xpr_t ): btype_t traceresult =
17101729 match x with
@@ -1726,6 +1745,7 @@ object (self)
17261745 (* let memoff_r = address_memory_offset t_unknown offset in *)
17271746 let memoff_r =
17281747 match offset with
1748+ | XConst (IntConst n ) when n#equal numerical_zero -> Ok NoOffset
17291749 | XConst (IntConst n ) -> Ok (ConstantOffset (n, NoOffset ))
17301750 | _ ->
17311751 Error [__FILE__ ^ " :" ^ (string_of_int __LINE__) ^ " : "
@@ -1745,6 +1765,7 @@ object (self)
17451765 let offset = simplify_xpr (XOp (XMinus , [x; num_constant_expr maxC])) in
17461766 let gmemoff_r =
17471767 match offset with
1768+ | XConst (IntConst n ) when n#equal numerical_zero -> Ok NoOffset
17481769 | XConst (IntConst n ) -> Ok (ConstantOffset (n, NoOffset ))
17491770 | XOp (XMult, [XConst (IntConst n ); XVar v ]) ->
17501771 Ok (IndexOffset (v, n#toInt, NoOffset ))
@@ -1775,6 +1796,7 @@ object (self)
17751796 let memref_r = self#env#mk_base_variable_reference base in
17761797 let memoff_r =
17771798 match offset with
1799+ | XConst (IntConst n ) when n#equal numerical_zero -> Ok NoOffset
17781800 | XConst (IntConst n ) -> Ok (ConstantOffset (n, NoOffset ))
17791801 | XOp (XMult, [XConst (IntConst n ); XVar v ]) ->
17801802 Ok (IndexOffset (v, n#toInt, NoOffset ))
@@ -1805,6 +1827,7 @@ object (self)
18051827 (fun base ->
18061828 let offset = simplify_xpr (XOp (XMinus , [x; XVar base])) in
18071829 match offset with
1830+ | XConst (IntConst n ) when n#equal numerical_zero -> Ok NoOffset
18081831 | XConst (IntConst n ) -> Ok (ConstantOffset (n, NoOffset ))
18091832 | XOp (XMult, [XConst (IntConst n ); XVar v ]) ->
18101833 Ok (IndexOffset (v, n#toInt, NoOffset ))
@@ -1967,6 +1990,7 @@ object (self)
19671990 (log_error " decompose_address" " invalid memref" )
19681991 ~ok: (fun memref ->
19691992 let offset = match xoffset with
1993+ | XConst (IntConst n ) when n#equal numerical_zero -> NoOffset
19701994 | XConst (IntConst n ) -> ConstantOffset (n, NoOffset )
19711995 | XOp (XMult, [XConst (IntConst n ); XVar v ]) ->
19721996 IndexOffset (v, n#toInt, NoOffset )
@@ -1976,6 +2000,7 @@ object (self)
19762000 (self#env#mk_base_variable_reference v)
19772001 | Some (XConst (IntConst n ), xoffset ) ->
19782002 let offset = match xoffset with
2003+ | XConst (IntConst n ) when n#equal numerical_zero -> NoOffset
19792004 | XConst (IntConst n ) -> ConstantOffset (n, NoOffset )
19802005 | XOp (XMult, [XConst (IntConst n ); XVar v ]) ->
19812006 IndexOffset (v, n#toInt, NoOffset )
0 commit comments