diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2011-03-09 09:43:17 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2011-03-09 09:43:17 +0000 |
commit | 06c55ab8fa4c0bf59479faf03d30a51c780da36e (patch) | |
tree | 7d843aa10b43e96724d0717b1ab36fbef3e32ee6 /cfrontend | |
parent | 4b23f9300df9e2f532745f2810aaa1e0d61f08d8 (diff) | |
download | compcert-06c55ab8fa4c0bf59479faf03d30a51c780da36e.tar.gz compcert-06c55ab8fa4c0bf59479faf03d30a51c780da36e.zip |
Treat "char" as unsigned OR signed depending on the configuration.
Fixed infinite expansion of some recursive struct type where recursion goes through a typeded.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1596 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cfrontend')
-rw-r--r-- | cfrontend/C2C.ml | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml index b6ab3ba3..284b825b 100644 --- a/cfrontend/C2C.ml +++ b/cfrontend/C2C.ml @@ -239,7 +239,7 @@ let convertInt n = coqint_of_camlint(Int64.to_int32 n) let convertIkind = function | C.IBool -> unsupported "'_Bool' type"; (Unsigned, I8) - | C.IChar -> (Unsigned, I8) + | C.IChar -> ((if Configuration.signed_char then Signed else Unsigned), I8) | C.ISChar -> (Signed, I8) | C.IUChar -> (Unsigned, I8) | C.IInt -> (Signed, I32) @@ -275,12 +275,15 @@ let convertTyp env t = let (sg, sz) = convertIkind ik in Tint(sz, sg) | C.TFloat(fk, a) -> Tfloat(convertFkind fk) - | C.TPtr(C.TStruct(id, _), _) when List.mem id seen -> - Tcomp_ptr(intern_string ("struct " ^ id.name)) - | C.TPtr(C.TUnion(id, _), _) when List.mem id seen -> - Tcomp_ptr(intern_string ("union " ^ id.name)) | C.TPtr(ty, a) -> - Tpointer(convertTyp seen ty) + begin match Cutil.unroll env ty with + | C.TStruct(id, _) when List.mem id seen -> + Tcomp_ptr(intern_string ("struct " ^ id.name)) + | C.TUnion(id, _) when List.mem id seen -> + Tcomp_ptr(intern_string ("union " ^ id.name)) + | _ -> + Tpointer(convertTyp seen ty) + end | C.TArray(ty, None, a) -> (* Cparser verified that the type ty[] occurs only in contexts that are safe for Clight, so just treat as ty[0]. *) @@ -810,7 +813,6 @@ let convertInit env ty init = | Some(C.CEnum _) -> error "enum tag after constant folding" | None -> - Format.printf "%a@." Cprint.exp (0, e); error "initializer is not a compile-time constant" end | Init_array il -> |