summaryrefslogtreecommitdiff
path: root/cfrontend
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-02-20 14:48:06 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-02-20 14:48:06 +0000
commit902c3f9defe6599c20c74cf0af646e270fe91122 (patch)
tree6b2170753ee947c26195badc01397b6674d932d9 /cfrontend
parent83d60a2059f171509b5e7bb14ac70846488ebd8e (diff)
The C declaration associated with __stringlit_N globals now has type const char[N] instead of const char * as before (for no good reason). In particular, it means that string literals now have alignment 1, as they should.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1821 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cfrontend')
-rw-r--r--cfrontend/C2C.ml3
1 files changed, 2 insertions, 1 deletions
diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml
index a5a9fee..9703e0b 100644
--- a/cfrontend/C2C.ml
+++ b/cfrontend/C2C.ml
@@ -104,10 +104,11 @@ let name_for_string_literal env s =
incr stringNum;
let name = Printf.sprintf "__stringlit_%d" !stringNum in
let id = intern_string name in
+ let sz = Int64.of_int (String.length s + 1) in
Hashtbl.add decl_atom id
{ a_storage = C.Storage_static;
a_env = env;
- a_type = C.TPtr(C.TInt(C.IChar,[C.AConst]),[]);
+ a_type = C.TArray(C.TInt(C.IChar,[C.AConst]), Some sz, []);
a_fundef = None };
Sections.define_stringlit id;
Hashtbl.add stringTable s id;