Skip to content

Win64 AArch64 exception handling

Summary

A program that uses exceptions crashes silently and exception handling does not work.

System Information

  • Operating system: Windows 11
  • Processor architecture: AARCH64
  • Compiler version: trunk 3.3.1-12557-g2b0317f4
  • Device: Computer

Steps to reproduce

Compile and run the following program on Win64 ARM64:

program project2;

uses
  Classes, SysUtils;

begin
  WriteLn({$I %FPCTARGETOS%});
  WriteLn({$I %FPCTARGETCPU%});
  writeln('try');
  try
    writeln('try 1');
    try
      writeln('try 2');
      raise EInOutError.Create('test');
      writeln('try 3 (should not print)');
    except
      on e: exception do
      begin
        writeln('except');
        WriteLn(E.Message);
      end;
    end;
  finally
    WriteLn('finally');
  end;
  WriteLn('end');
  {This also produces a suspicious hint: Local proc "$fin$00000001" is not used}
end.      

What is the current bug behavior?

The program prints the following lines and silently crashes:

try
try 1
try 2

What is the expected (correct) behavior?

The program must print the following lines when exception handling works correctly, like on x86_64:

try
try 1
try 2
except
test
finally
end

Relevant logs and/or screenshots

zzz

Edited by foxpas
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information