* don't emit default values for local variables in generic routines: those

default values are not used, and they are not type-correct (and hence
    cause trouble with LLVM)

git-svn-id: trunk@33992 -
This commit is contained in:
Jonas Maebe 2016-06-15 18:32:02 +00:00
parent 5313db710b
commit 899add8c7d

View File

@ -1056,6 +1056,7 @@ implementation
var
vs : tabstractnormalvarsym;
tcsym : tstaticvarsym;
templist : tasmlist;
begin
vs:=tabstractnormalvarsym(sc[0]);
if sc.count>1 then
@ -1068,9 +1069,19 @@ implementation
begin
tcsym:=cstaticvarsym.create('$default'+vs.realname,vs_const,vs.vardef,[],true);
include(tcsym.symoptions,sp_internal);
vs.defaultconstsym:=tcsym;
symtablestack.top.insert(tcsym);
read_typed_const(current_asmdata.asmlists[al_typedconsts],tcsym,false);
templist:=tasmlist.create;
read_typed_const(templist,tcsym,false);
{ in case of a generic routine, this initialisation value is not
used, and will be re-parsed during specialisations (and the
current version is not type-correct and hence breaks code
generation for LLVM) }
if not parse_generic then
begin
vs.defaultconstsym:=tcsym;
current_asmdata.asmlists[al_typedconsts].concatlist(templist);
end;
templist.free;
end;
staticvarsym :
begin