From 1c820e9c8e85a26f6e863d6b120e65b283c8e19f Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 27 Nov 2016 21:54:50 +0000 Subject: [PATCH] * similar change as in r34976 for the generic code: don't assume that if a load node for a procsym has a self pointer, that we have to create a procvar with a self pointer (e.g. when loading the address of a static class method). Avoids the generation of superfluous code to load self which is then not used afterwards git-svn-id: trunk@35005 - --- compiler/ncgld.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/ncgld.pas b/compiler/ncgld.pas index 8638e5cfaf..d030aa7326 100644 --- a/compiler/ncgld.pas +++ b/compiler/ncgld.pas @@ -521,7 +521,9 @@ implementation begin if not assigned(procdef) then internalerror(200312011); - if assigned(left) then + if assigned(left) and + (resultdef.typ in [symconst.procdef,procvardef]) and + not tabstractprocdef(resultdef).is_addressonly then begin location_reset(location,LOC_CREGISTER,int_cgsize(voidpointertype.size*2)); secondpass(left);