From c4f1ca931fe19f7e8e67cca6bb56dd867770d1d0 Mon Sep 17 00:00:00 2001 From: xleroy Date: Tue, 18 Mar 2014 10:31:11 +0000 Subject: Support array initialization lists that are too short git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2432 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cfrontend/Initializers.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cfrontend/Initializers.v') diff --git a/cfrontend/Initializers.v b/cfrontend/Initializers.v index 1b339c18..f180f980 100644 --- a/cfrontend/Initializers.v +++ b/cfrontend/Initializers.v @@ -190,8 +190,8 @@ with transl_init_array (ty: type) (il: initializer_list) (sz: Z) {struct il} : res (list init_data) := match il with | Init_nil => - if zeq sz 0 - then OK nil + if zeq sz 0 then OK nil + else if zle 0 sz then OK (Init_space (sz * sizeof ty) :: nil) else Error (msg "wrong number of elements in array initializer") | Init_cons i1 il' => do d1 <- transl_init ty i1; -- cgit