aboutsummaryrefslogtreecommitdiffstats
path: root/cfrontend/PrintCsyntax.ml
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2009-11-01 09:55:35 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2009-11-01 09:55:35 +0000
commit033aa0555a209fa3e825b1eeb8a5fc00ff8163e3 (patch)
treeb107715bdfd95d6aa1080e96cc5b919bb94ae3fb /cfrontend/PrintCsyntax.ml
parent258a1feeafb9ebcec4d46601fe7016bed04a8ea7 (diff)
downloadcompcert-033aa0555a209fa3e825b1eeb8a5fc00ff8163e3.tar.gz
compcert-033aa0555a209fa3e825b1eeb8a5fc00ff8163e3.zip
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 'cfrontend/PrintCsyntax.ml')
-rw-r--r--cfrontend/PrintCsyntax.ml5
1 files changed, 5 insertions, 0 deletions
diff --git a/cfrontend/PrintCsyntax.ml b/cfrontend/PrintCsyntax.ml
index 88e24eed..fa1d0482 100644
--- a/cfrontend/PrintCsyntax.ml
+++ b/cfrontend/PrintCsyntax.ml
@@ -378,6 +378,11 @@ let print_init p = function
| Init_float32 n -> fprintf p "%F,@ " n
| Init_float64 n -> fprintf p "%F,@ " n
| Init_space n -> fprintf p "/* skip %ld, */@ " (camlint_of_coqint n)
+ | Init_addrof(symb, ofs) ->
+ let ofs = camlint_of_coqint ofs in
+ if ofs = 0l
+ then fprintf p "&%s,@ " (extern_atom symb)
+ else fprintf p "(void *)((char *)&%s + %ld),@ " (extern_atom symb) ofs
| Init_pointer id ->
match string_of_init id with
| None -> fprintf p "/* pointer to other init*/,@ "