Array access fails
Original Reporter info from Mantis: Ville Krumlinde
-
Reporter name:
Original Reporter info from Mantis: Ville Krumlinde
- Reporter name:
Description:
Calling this function with a valid index gives incorrect output on aarch64. Tested on MacBook Air M1, macOS 11.2.1.
const
lowlimit = 536879040;
procedure test(i : integer);
const
myarray : array[lowlimit..lowlimit+2] of integer = (1,2,3);
begin
writeln('value: ',myarray[i]);
end;
Steps to reproduce:
Build attached project.
Run it.
Expected output is "1".
At least 4 times out of 5 here it will output other values here.
Additional information:
Using a lower number than "536879040" will work so I guess the code generation for aarch64 does not correctly reduce the array index with this value.
Mantis conversion info:
- Mantis ID: 38636
- OS: macOS
- OS Build: 11.2.1
- Platform: aarch64
- Version: 3.2.1
- Fixed in version: 3.3.1
- Fixed in revision: 49065 (#308aee42)