[x86] Internal error 200410108 when using unaligned types with vectorcall
Summary
When compiling the following code under -O2 on x86_64-win64, as of commit 815734c4 (and earlier)...
program m128test;
type
UnalignedArray = array[0..1] of Double;
function Test3(V1, V2: UnalignedArray): UnalignedArray; vectorcall;
begin
Test3[1] := V1[1] + V2[1];
end;
begin
end.
...the compiler fails with "m128.pp(7,1) Fatal: Internal error 200410108" (location (7,1) is the begin
keyword) in the subroutine.
System Information
- Operating system: Microsoft Windows 10 Home
- Processor architecture: x86-64
- Compiler version: Trunk (815734c4)
- Device: HP Omen 15 laptop computer
Steps to reproduce
Write the above code as is and attempt to compile it under -O2 options using the trunk compiler on the x86_64-win64 platform. Internal error 200410108 should be raised. The error does not occur under -O1 and -O-, or if vectorcall
is removed.
What is the current bug behavior?
Internal error 200410108 is raised on the begin
keyword in the subroutine.
What is the expected (correct) behavior?
The project should compile successfully and the generated assembly language should be identical to a version where vectorcall
is omitted (i.e. parameters are passed on the stack).
Possible fixes
The compiler seems to be limited in how it can handle arrays that are wholly stored in registers (i.e. types such as __m128), although this error does not seem related to that because vectorcall
should reject passing these unaligned types as registers. Some work is being done at !193 (merged), but that is on-going development.