From c77bca83893bc8ebc2c4313ba521a390ec874037 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Thu, 31 Dec 2015 17:01:26 -0600 Subject: [PATCH] When arrays are declared using a typedef'd incomplete array type, don't fix the size for all arrays of that type based on the initializer of the first array using it. This fixes the compca07.c test case. --- Parser.pas | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Parser.pas b/Parser.pas index eea8dad..ea4f9b0 100644 --- a/Parser.pas +++ b/Parser.pas @@ -3505,6 +3505,13 @@ else {if not isFunction then} begin Error(52); if doingPrototypes then Error(88); + {allocate copy of incomplete array type,} + tp := variable^.itype; {so it can be completed by Initializer} + if (tp^.kind = arrayType) and (tp^.elements = 0) then begin + variable^.itype := pointer(Malloc(sizeof(typeRecord))); + variable^.itype^ := tp^; + variable^.itype^.saveDisp := 0; + end; NextToken; {handle an initializer} ltypeSpec := typeSpec; Initializer(variable);