summaryrefslogtreecommitdiff
path: root/cfrontend
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-12-30 10:52:40 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-12-30 10:52:40 +0000
commit22fc05453ab31524f9e8439ddd720510fb3a1938 (patch)
tree88aff4b4e6dbcf0985be7fcfa0e19ab028dbd876 /cfrontend
parentc167c00901b85bd4e66447958a10df612d17ea00 (diff)
Improved detection of variables with incomplete types.
Additional warnings for empty initializer braces and zero-sized arrays. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2390 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cfrontend')
-rw-r--r--cfrontend/C2C.ml4
1 files changed, 3 insertions, 1 deletions
diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml
index ff12823..ba599da 100644
--- a/cfrontend/C2C.ml
+++ b/cfrontend/C2C.ml
@@ -834,8 +834,10 @@ let convertGlobvar loc env (sto, id, ty, optinit) =
let (section, access) =
Sections.for_variable env id' ty (optinit <> None) in
if Z.gt sz (Z.of_uint64 0xFFFF_FFFFL) then
- error (sprintf "Variable %s is too big (%s bytes)"
+ error (sprintf "'%s' is too big (%s bytes)"
id.name (Z.to_string sz));
+ if Cutil.incomplete_type env ty then
+ error (sprintf "'%s' has incomplete type" id.name);
Hashtbl.add decl_atom id'
{ a_storage = sto;
a_alignment = Some (Z.to_int al);