Anonymous Function and Optimization compiler crash
Summary
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
- Operating system: macOS
- Processor architecture: x86_64
- Compiler version: trunk efbf5eaa
- Device:
Steps to reproduce
Compile attached tanonfunc71.pp test file with ppcx64 on macOS
ppcx64 tanonfunc71.pp
Example Project
What is the current bug behavior?
[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?
Compile without error
Relevant logs and/or screenshots
Possible fixes
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.
Edited by Sven/Sarah Barth