December 13, 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: https://github.com/dlang/dmd/pull/10200

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

Here someone encountered this when upgrading dmd:
Issue 22588 - Array corruption with std.conv.to

This is really bad.

Here's my attempt to fix it:
https://github.com/dlang/dmd/pull/13256

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.