aboutsummaryrefslogtreecommitdiffstats
path: root/exportclight
diff options
context:
space:
mode:
authorBernhard Schommer <bschommer@users.noreply.github.com>2018-01-15 10:28:40 +0100
committerXavier Leroy <xavierleroy@users.noreply.github.com>2018-01-15 10:28:40 +0100
commitce7013f94c97b0e46da03c97812b38df001fbc9d (patch)
tree878fce9d31a4a02b8699f9cdadf4794c811df049 /exportclight
parent879ba4632717690cb3fbf0010b038fe6dc3c231e (diff)
downloadcompcert-kvx-ce7013f94c97b0e46da03c97812b38df001fbc9d.tar.gz
compcert-kvx-ce7013f94c97b0e46da03c97812b38df001fbc9d.zip
Use Ptrofs.repr instead of Int.repr for Init_addrof. (#51)
This should fix issue 216 and also allows it to print 64 bit offsets.
Diffstat (limited to 'exportclight')
-rw-r--r--exportclight/ExportClight.ml8
1 files changed, 7 insertions, 1 deletions
diff --git a/exportclight/ExportClight.ml b/exportclight/ExportClight.ml
index f5b8150d..6f5e3cdc 100644
--- a/exportclight/ExportClight.ml
+++ b/exportclight/ExportClight.ml
@@ -109,6 +109,12 @@ let coqint p n =
then fprintf p "(Int.repr %ld)" n
else fprintf p "(Int.repr (%ld))" n
+let coqptrofs p n =
+ let s = Z.to_string n in
+ if Z.ge n Z.zero
+ then fprintf p "(Ptrofs.repr %s)" s
+ else fprintf p "(Ptrofs.repr (%s))" s
+
let coqint64 p n =
let n = camlint64_of_coqint n in
if n >= 0L
@@ -393,7 +399,7 @@ let init_data p = function
| Init_float32 n -> fprintf p "Init_float32 %a" coqsingle n
| Init_float64 n -> fprintf p "Init_float64 %a" coqfloat n
| Init_space n -> fprintf p "Init_space %ld" (Z.to_int32 n)
- | Init_addrof(id,ofs) -> fprintf p "Init_addrof %a %a" ident id coqint ofs
+ | Init_addrof(id,ofs) -> fprintf p "Init_addrof %a %a" ident id coqptrofs ofs
let print_variable p (id, v) =
fprintf p "Definition v_%s := {|@ " (extern_atom id);