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

Dennis dkorpel at gmail.com
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:  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](https://issues.dlang.org/show_bug.cgi?id=22163)

Here someone encountered this when upgrading dmd:
[Issue 22588 - Array corruption with 
std.conv.to](https://issues.dlang.org/show_bug.cgi?id=22588)

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.


More information about the Digitalmars-d mailing list