Anonymous Function and Optimization compiler crash
## Summary <!-- Summarize the bug encountered concisely --> We found an anonymous function, function reference test case that when compiled with optimization on (O2 or higher) causes ppcx64 on macos x86_64 to crash with fatal internal error 200409241. I have only tested it on macos x86_64. ## System Information <!-- The more information are provided the easier it is to replicate the bug --> - **Operating system:** macOS <!-- Windows, Linux (if possible, also name the distro), FreeBSD, Android, ... --> - **Processor architecture:** x86_64<!-- x86, x86-64, ARM, AARCH64, AVR, RISC-V, PowerPC, ... --> - **Compiler version:** trunk EFBF5EA<!-- 3.2, 3.2.2, 3.3, trunk, beta, ... (if possible, give also the git hash) --> - **Device:** <!-- Computer, Tablet, Mobile, Amiga, Microcontroller, ... --> ## Steps to reproduce <!-- How one can reproduce the issue - this is very important! --> Compile attached tanonfunc71.pp test file with ppcx64 on macOS ppcx64 tanonfunc71.pp ## Example Project [tanonfunc71.pp](/uploads/6e8d5edf52d424c88ddc72343e47947a/tanonfunc71.pp) <!-- If possible, please create an example project that exhibits the problematic behavior, and link to it here in the bug report. --> ## What is the current bug behavior? <!-- What actually happens --> ``` [athos:test$] ../../compiler/ppcx64 tanonfunc71.pp Free Pascal Compiler version 3.3.1 [2022/09/22] for x86_64 Copyright (c) 1993-2022 by Florian Klaempfl and others Target OS: Darwin for x86_64 Compiling tanonfunc71.pp tanonfunc71.pp(45,5) Fatal: Internal error 200409241 Fatal: Compilation aborted ``` ## What is the expected (correct) behavior? <!-- What you should see instead --> Compile without error ## Relevant logs and/or screenshots <!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code, as it's very hard to read otherwise. You can also use syntax highlighting for Pascal with: ```pascal the code``` For more information see https://docs.gitlab.com/ee/user/markdown.html --> ## Possible fixes <!-- If you can, link to the line of code that might be responsible for the problem --> It is definitely optimization related i.e. if I compile without optimization or with only O1 there is no crash. It also appears to be related to the 'self' param passed into the functions DlgSync() and CheckOut(). If I pass a different TObject to those functions then it compiles fine. Which also means that CopyFile being a method of object is also required.
issue