Help needed: DMD corrupts parameters that are small float arrays/structs

Dennis dkorpel at
Mon Dec 13 13:24:29 UTC 2021

Small static arrays and structs are passed to a function in 
registers, but when they have float members and the function body 
has a nested function inside it (creating a closure), DMD reads 
the floats wrong. This is a regression introduced by the big 
Posix ABI fixes PR:

I encountered this while writing new code and filed this on 
[Issue 22163 - wrong code with static float array and delegate 
accessing it](

Here someone encountered this when upgrading dmd:
[Issue 22588 - Array corruption with](

This is really bad.

Here's my attempt to fix it:

But I could really use a review from someone familiar with the 
Posix ABI/volatile parameters. Also, the new test case for it 
fails on Windows, but I don't have a working dmd development 
environment set up on Windows yet, so it will take me some time 
to find the cause of that.

More information about the Digitalmars-d mailing list