diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2012-02-20 14:48:06 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2012-02-20 14:48:06 +0000 |
commit | 902c3f9defe6599c20c74cf0af646e270fe91122 (patch) | |
tree | 6b2170753ee947c26195badc01397b6674d932d9 | |
parent | 83d60a2059f171509b5e7bb14ac70846488ebd8e (diff) | |
download | compcert-902c3f9defe6599c20c74cf0af646e270fe91122.tar.gz compcert-902c3f9defe6599c20c74cf0af646e270fe91122.zip |
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
-rw-r--r-- | cfrontend/C2C.ml | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml index a5a9fee1..9703e0b4 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; |