Skip to content

Commit 3f2cd54

Browse files
committed
Introduce cprover_memory
into the symbol table. Since it was missing and CBMC need it for pointer analysis.
1 parent 2db62c7 commit 3f2cd54

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

gnat2goto/driver/driver.adb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,29 @@ package body Driver is
260260
Source_Location => No_Location));
261261
end Initialize_CProver_Malloc_Object;
262262

263+
procedure Initialize_CProver_Memory;
264+
procedure Initialize_CProver_Memory is
265+
Memory_Type : constant Irep := Make_Pointer_Type
266+
(I_Subtype => Make_Void_Type,
267+
Width => Pointer_Type_Width);
268+
Memory_Sym : constant Irep := Make_Symbol_Expr
269+
(I_Type => Memory_Type,
270+
Identifier => "__CPROVER_memory",
271+
Source_Location => No_Location);
272+
Memory_Val : constant Irep := Integer_Constant_To_BV_Expr
273+
(Value => Uint_0,
274+
Expr_Type => Memory_Type,
275+
Source_Location => No_Location);
276+
begin
277+
Declare_Missing_Global (Memory_Sym);
278+
Append_Op
279+
(Start_Body,
280+
Make_Code_Assign
281+
(Lhs => Memory_Sym,
282+
Rhs => Memory_Val,
283+
Source_Location => No_Location));
284+
end Initialize_CProver_Memory;
285+
263286
procedure Initialize_Enum_Values;
264287
procedure Initialize_Enum_Values is
265288

@@ -348,6 +371,7 @@ package body Driver is
348371
Initialize_CProver_Dead_Object;
349372
Initialize_CProver_Deallocated;
350373
Initialize_CProver_Malloc_Object;
374+
Initialize_CProver_Memory;
351375
Initialize_Enum_Values;
352376
Initialize_Boolean_Values;
353377
end Initialize_CProver_Internal_Variables;

0 commit comments

Comments
 (0)