From 9cb3b2cd5ce322cecf9ef7c9b10296c6057b0ddb Mon Sep 17 00:00:00 2001 From: xleroy Date: Sun, 18 May 2014 07:22:02 +0000 Subject: Another corner case for string literal initializers: char * x[] = { "lit" } git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2498 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cparser/Elab.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cparser') diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 34c545f..7824bc3 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -1601,7 +1601,8 @@ and elab_item zi item il = or wchar array = L"wide string literal" *) | (SINGLE_INIT (CONSTANT (CONST_STRING(w, s))) | COMPOUND_INIT [_, SINGLE_INIT(CONSTANT (CONST_STRING(w, s)))]), - TArray(ty_elt, sz, _) -> + TArray(ty_elt, sz, _) + when is_integer_type env ty_elt -> begin match elab_string_literal loc w s, unroll env ty_elt with | CStr s, TInt((IChar | ISChar | IUChar), _) -> if not (I.index_below (Int64.of_int(String.length s - 1)) sz) then -- cgit v1.2.3