Invalid "Type size mismatch, possible loss of data" for for-in loop when compiling for x86_64
Summary
Consider the following program:
program test;
procedure foo;
var
i: integer;
a: array of integer;
begin
a := NIL;
for i in a do
begin
end;
end;
begin
foo;
end.
Everything is fine when I compile it with fpc -vh -CO test.pas
. But once I add -Px86_64
, it emits a Type size mismatch, possible loss of data / range check error
hint for for i in a do
:
fpc -vh -CO -Px86_64 test.pas
Hint: Start of reading config file C:\FPC\3.2.2\bin\i386-Win32\fpc.cfg
Hint: End of reading config file C:\FPC\3.2.2\bin\i386-Win32\fpc.cfg
Free Pascal Compiler version 3.2.2 [2021/05/15] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling test.pas
test.pas(9,7) Hint: Type size mismatch, possible loss of data / range check error
You can also replace integer
by string
, and the result will still be the same.
System Information
- Operating system: Windows 7
- Processor architecture: x86-64
- Compiler version: 3.2.2
- Device: Computer
Edited by Daniel Plakhotich