Compilation problem for aarch64-darwin-cocoa
Original Reporter info from Mantis: IgorKokarev
-
Reporter name: Igor Kokarev
Original Reporter info from Mantis: IgorKokarev
- Reporter name: Igor Kokarev
Description:
FPC Trunk for macOS AARCH64 can't compile attached test project with O2 code optimization or higher.
It fails on line:
Row_Buffer[RowUsed][Col] := (Row_Buffer[RowUsed][Col] + (left + above) div 2) and 255;
"Error: /Users/igor/armtest/lib/aarch64-darwin/testarm.s:49:7: error: invalid operand for instruction
Error: Error while assembling exitcode 1"
No problem with O0 or O1 code optimizations.
8964Lazarus 2.1.0 r63630 FPC 3.3.1 aarch64-darwin-cocoa
Steps to reproduce:
program testarm;
{$ifdef fpc}{$mode Delphi}{$endif}
type
TByteArray = Array[Word] of Byte;
PByteArray = ^TByteArray;
procedure Test;
var
Row_Buffer : array[Boolean] of PByteArray;
Col : Cardinal;
left, above : Integer;
RowUsed : Boolean;
begin
Col:=0;
left:=1;
above:=2;
RowUsed:=False;
Row_Buffer[RowUsed]:=GetMem(1);
Row_Buffer[RowUsed][Col] := (Row_Buffer[RowUsed][Col] + (left + above) div 2) and 255;
FreeMem(Row_Buffer[RowUsed]);
end;
begin
Test; WriteLn;
Write('Press ENTER to Exit'); ReadLn;
end.
Additional information:
This problem occurs only with AARCH64 compiler on Apple DTK.
Also this code compiles fine for x86-64 on Windows 10 and macOS with Intel CPU.
Mantis conversion info:
- Mantis ID: 37443
- OS: macOS
- OS Build: 11 Beta
- Build: r63630
- Platform: Apple Silicon
- Version: 2.1 (SVN)
- Fixed in version: 3.3.1