[AVR] Internal error 2017091103 when passing a procedural type parameter
## Summary When passing a procedural type parameter via a method, internal error 2017091103 is generated. ## System Information The example code works fine on 64 bit Linux, but fails when compiled for avrsim. ## Steps to reproduce ``` $ ~/fpc/gitlab-cc/compiler/ppcrossavr -n @~/fpc/gitlab-cc/fpc.cfg -Wpavrsim -XPavr- project1.lpr Free Pascal Compiler version 3.3.1 [2022/02/26] for avr Copyright (c) 1993-2022 by Florian Klaempfl and others Target OS: Embedded Compiling project1.lpr project1.lpr(32,3) Fatal: Internal error 2017091103 Fatal: Compilation aborted ``` Note that line 32 refers to this code line: `setDelegate(@DoIt);` Changing to _-O2_: ``` $ ~/fpc/gitlab-cc/compiler/ppcrossavr -n @~/fpc/gitlab-cc/fpc.cfg -Wpavrsim -XPavr- -O2 project1.lpr Free Pascal Compiler version 3.3.1 [2022/02/26] for avr Copyright (c) 1993-2022 by Florian Klaempfl and others Target OS: Embedded Compiling project1.lpr project1.lpr(26,1) Fatal: Internal error 2017091103 Fatal: Compilation aborted ``` Note that line 26 is the code line just before: `delegate := ADelegate;` ## Example Project ``` program project1; type TDelegateProc = procedure of object; TParentObj = object private delegate: TDelegateProc; public procedure callDelegate; procedure setDelegate(const ADelegate: TDelegateProc); end; TChildObj = object(TParentObj) public procedure Init; procedure DoIt; end; procedure TParentObj.callDelegate; begin delegate(); end; procedure TParentObj.setDelegate(const ADelegate: TDelegateProc); begin delegate := ADelegate; end; procedure TChildObj.Init; begin setDelegate(@DoIt); end; procedure TChildObj.DoIt; begin writeln('Did it!'); end; var obj1: TChildObj; begin obj1.Init; obj1.callDelegate; end. ``` ## What is the expected (correct) behavior? The procedural type parameter ( should be passed and stored correctly, as per Linux target.
issue