[Issue 24553] New: all 0 struct initializer with float is still stored in data section
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 16 23:08:16 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24553
Issue ID: 24553
Summary: all 0 struct initializer with float is still stored in
data section
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: backend
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: schveiguy at gmail.com
Consider these structs:
```d
struct A {
int[10000] x;
}
struct B {
float[10000] x;
}
struct C {
float[10000] x = 0;
}
struct D {
char[10000] x = 0;
}
```
A and D do not store any static data in the binary, because they are
zero-initialized types (char.init is non-zero, but the assignment sets it to
0).
B obviously must store static data because float.init is NaN.
But C still stores static data (10000 32-bit 0s). This should not happen.
--
More information about the Digitalmars-d-bugs
mailing list