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.
This commit is contained in:
Stephen Heumann 2015-12-31 17:01:26 -06:00
parent 78493936bc
commit c77bca8389
1 changed files with 7 additions and 0 deletions

View File

@ -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);