From b21963828478b77ea764ce7876f656fa0558d449 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Mon, 18 Feb 2013 16:53:37 +0000 Subject: [PATCH] Ensure that no garbage for specialization code is written in case of "-al" assemble.pas, TExternalAssembler.WriteSourceLine: * also respect a module change which can happen if the generated assembler code belongs to a specialized generic git-svn-id: trunk@23628 - --- compiler/assemble.pas | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/compiler/assemble.pas b/compiler/assemble.pas index 9c1c9a9603..d05ee97471 100644 --- a/compiler/assemble.pas +++ b/compiler/assemble.pas @@ -704,11 +704,21 @@ Implementation end; procedure TExternalAssembler.WriteSourceLine(hp: tailineinfo); + var + module : tmodule; begin { load infile } - if lastfileinfo.fileindex<>hp.fileinfo.fileindex then + if (lastfileinfo.moduleindex<>hp.fileinfo.moduleindex) or + (lastfileinfo.fileindex<>hp.fileinfo.fileindex) then begin - infile:=current_module.sourcefiles.get_file(hp.fileinfo.fileindex); + { in case of a generic the module can be different } + if current_module.unit_index=hp.fileinfo.moduleindex then + module:=current_module + else + module:=get_module(hp.fileinfo.moduleindex); + if not assigned(module) then + internalerror(2013021801); + infile:=module.sourcefiles.get_file(hp.fileinfo.fileindex); if assigned(infile) then begin { open only if needed !! } @@ -717,6 +727,7 @@ Implementation end; { avoid unnecessary reopens of the same file !! } lastfileinfo.fileindex:=hp.fileinfo.fileindex; + lastfileinfo.moduleindex:=hp.fileinfo.moduleindex; { be sure to change line !! } lastfileinfo.line:=-1; end;