AArch64 functions with many arguments fail at higher optimization levels
Original Reporter info from Mantis: crlab @neurolabusc1
-
Reporter name: Chris Rorden
Original Reporter info from Mantis: crlab @neurolabusc1
- Reporter name: Chris Rorden
Description:
This program runs nicely at low optimization levels, but drops values at optimization level 2 or higher:
% fpc -O1 fx.pas
Free Pascal Compiler version 3.3.1 [2020/07/18] for aarch64
Copyright (c) 1993-2020 by Florian Klaempfl and others
Target OS: Darwin for AArch64
Compiling fx.pas
Assembling (pipe) fx.s
Linking fx
13 lines compiled, 0.2 sec
% ./fx
1.000000000E+00 2.000000000E+00 3.000000000E+00 4.000000000E+00
5.000000000E+00 6.000000000E+00 7.000000000E+00 8.000000000E+00
9.000000000E+00 1.000000000E+01 1.100000000E+01 1.200000000E+01
% fpc -O3 fx.pas
Free Pascal Compiler version 3.3.1 [2020/07/18] for aarch64
Copyright (c) 1993-2020 by Florian Klaempfl and others
Target OS: Darwin for AArch64
Compiling fx.pas
Assembling (pipe) fx.s
Linking fx
13 lines compiled, 0.2 sec
% ./fx
1.000000000E+00 2.000000000E+00 3.000000000E+00 4.000000000E+00
5.000000000E+00 6.000000000E+00 7.000000000E+00 8.000000000E+00
0.000000000E+00 0.000000000E+00 0.000000000E+00 1.200000000E+01
Steps to reproduce:
Run this program at optimization level 2 or higher
program fx;
procedure rep9(a,b,c,d, e,f,g,h, i,j,k,l: single);
begin
writeln(a, ' ', b, ' ', c, ' ', d);
writeln(e, ' ', f, ' ', g, ' ', h);
writeln(i, ' ', j, ' ', k, ' ', l);
end;
begin
rep9(1,2,3,4,5,6,7,8,9,10,11,12);
end.
Mantis conversion info:
- Mantis ID: 37393
- OS: Darwin
- OS Build: 10.11.6
- Build: 45784
- Platform: MacBook 2012 Retina 13"
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 45814 (#13cb57b2)