A static array of reals passed to a function as an r-value may have an incorrect value inside the function. The correctness depends on what is defined before the array in the caller's stack frame. Here's an example.
```
// bug.d
import std.stdio;
void f(real[1] x)
do {
writefln("x[0] = %e", x[0]);
assert(x[0] == 2.0L, "x[0] != 2");
}
void main()
do {
version (succeeds) {
int _ = 1;
} else {
double _ = 1.0;
}
real[1] y = [ 2.0L ];
f(y);
}
```
If an int is defined prior to the array, the program works as expected, but if a double is defined, the program fails.
```
? rdmd -version=succeeds bug.d
x[0] = 2.000000e+00
? rdmd -version=fails bug.d
x[0] = -4.344603e-713
[email protected](8): x[0] != 2
----------------
??:? _d_assert_msg [0x55558abc29e4]
??:? void bug.f(real[1]) [0x55558ab95921]
??:? _Dmain [0x55558ab9596b]
```
I'm using dmd version 2.098.0 and rdmd build 20211010.