[fpc-devel] LLVM, interfaces and nested procedure variables

Kieran kizz32 at gmail.com
Sat Nov 25 12:48:55 CET 2023


Hi,

I'm trying to reproduce a minimal viable demo of a problem compiling code
using the LLVM backend that has an interface with a parameter that is a
nested procedure variable, but I'm not having any luck. I've noticed the
difference between my test programs and the large project where I'm seeing
the issue reliably is that when compiling the larger project, the line "Parsing
internally generated code" (I think that's error string 3319/"Parsen intern
erzeugten") gets output with what looks like interface method shims for an
object -- methods prefixed "WRPR_".

 I can't get my test programs to do the same even when trying the same
compiler arguments and directives, so I've tried to make the objects more
complicated -- adding variables to the class, lots of procedures, multiple
interfaces, implementations that are actually abstract... nothing's
triggered it.

The gist of my test code is something like this:

TNestedProc = procedure is nested;

IInf = interface[...]
    procedure InfMethod(AParam: TNestedProc);
end;

TObj = class(..., IInf)

My question is: what are some triggers for internal code generation?

As to the actual error that I'm trying to put together a useful bug report
for, the code that is generated internally (in the shim) gets the error "Error:
(4030) Can't assign local procedure/function to procedure variable", it's
in the same unit as both a {$modeswitch nestedprocvars} and a bunch of
other code that throw around nested procedure variables.

Thanks
Kieran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20231125/e5167d97/attachment.htm>


More information about the fpc-devel mailing list