aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-03-03 13:15:43 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-03-03 13:15:43 +0000
commit16e42ca83c3282ba7de830fb8a40623c6ac04dc7 (patch)
treec7431f957d44ea0ce377fecbafe98525c34f211b
parentf961ff40adc1eb853a628c7fb10010e55e7c93e9 (diff)
downloadcompcert-kvx-16e42ca83c3282ba7de830fb8a40623c6ac04dc7.tar.gz
compcert-kvx-16e42ca83c3282ba7de830fb8a40623c6ac04dc7.zip
Detect struct assignment. Silence some warnings
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1273 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
-rw-r--r--cfrontend/C2Clight.ml10
1 files changed, 7 insertions, 3 deletions
diff --git a/cfrontend/C2Clight.ml b/cfrontend/C2Clight.ml
index fcb0c7c1..2ad2ac5e 100644
--- a/cfrontend/C2Clight.ml
+++ b/cfrontend/C2Clight.ml
@@ -161,7 +161,9 @@ let convertTyp env t =
| C.TPtr(ty, a) ->
Tpointer(convertTyp seen ty)
| C.TArray(ty, None, a) ->
- warning "array type of unspecified size";
+ (* Cparser verified that the type ty[] occurs only in
+ contexts that are safe for Clight, so just treat as ty[0]. *)
+ (* warning "array type of unspecified size"; *)
Tarray(convertTyp seen ty, coqint_of_camlint 0l)
| C.TArray(ty, Some sz, a) ->
Tarray(convertTyp seen ty, convertInt sz)
@@ -323,11 +325,11 @@ let convertFuncall env lhs fn args =
let fun_name =
match fn with
| {edesc = C.EVar id} when !Clflags.option_fvararg_calls ->
- warning "emulating call to variadic function";
+ (*warning "emulating call to variadic function"; *)
id.name
| _ ->
unsupported "call to variadic function";
- "" in
+ "<error>" in
let targs = convertTypList env (List.map (fun e -> e.etyp) args) in
let tres = convertTyp env res in
let (stub_fun_name, stub_fun_typ) =
@@ -343,6 +345,8 @@ let convertTopExpr env e =
| C.EBinop(C.Oassign, lhs, {edesc = C.ECall(fn, args)}, _) ->
convertFuncall env (Some lhs) fn args
| C.EBinop(C.Oassign, lhs, rhs, _) ->
+ if Cutil.is_composite_type env lhs.etyp then
+ unsupported "assignment between structs or between unions";
Sassign(convertExpr env lhs, convertExpr env rhs)
| C.ECall(fn, args) ->
convertFuncall env None fn args