summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2009-11-01 09:55:35 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2009-11-01 09:55:35 +0000
commit033aa0555a209fa3e825b1eeb8a5fc00ff8163e3 (patch)
treeb107715bdfd95d6aa1080e96cc5b919bb94ae3fb /common
parent258a1feeafb9ebcec4d46601fe7016bed04a8ea7 (diff)
Support Clight initializers of the form "int * x = &y;".
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1162 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'common')
-rw-r--r--common/AST.v1
-rw-r--r--common/Mem.v4
2 files changed, 5 insertions, 0 deletions
diff --git a/common/AST.v b/common/AST.v
index e7b85a9..13e84dd 100644
--- a/common/AST.v
+++ b/common/AST.v
@@ -91,6 +91,7 @@ Inductive init_data: Type :=
| Init_float32: float -> init_data
| Init_float64: float -> init_data
| Init_space: Z -> init_data
+ | Init_addrof: ident -> int -> init_data (**r address of symbol + offset *)
| Init_pointer: list init_data -> init_data.
(** Whole programs consist of:
diff --git a/common/Mem.v b/common/Mem.v
index 01c1975..6510828 100644
--- a/common/Mem.v
+++ b/common/Mem.v
@@ -568,6 +568,9 @@ Fixpoint contents_init_data (pos: Z) (id: list init_data) {struct id}: contentma
setN 7%nat pos (Vfloat f) (contents_init_data (pos + 1) id')
| Init_space n :: id' =>
contents_init_data (pos + Zmax n 0) id'
+ | Init_addrof s n :: id' =>
+ (* Not handled properly yet *)
+ contents_init_data (pos + 4) id'
| Init_pointer x :: id' =>
(* Not handled properly yet *)
contents_init_data (pos + 4) id'
@@ -581,6 +584,7 @@ Definition size_init_data (id: init_data) : Z :=
| Init_float32 _ => 4
| Init_float64 _ => 8
| Init_space n => Zmax n 0
+ | Init_addrof _ _ => 4
| Init_pointer _ => 4
end.