Bug 22588 – Array corruption with std.conv.to

Status
RESOLVED
Resolution
DUPLICATE
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2021-12-12T12:29:06Z
Last change time
2021-12-13T13:03:48Z
Assigned to
No Owner
Creator
naydef

Comments

Comment #0 by naydef — 2021-12-12T12:29:06Z
The assertion fails in the following code: ``` import std.math; import std.conv; void main(string[] args) { auto res = to!(float[2][])([[0, 0]]); assert(isClose(res[0][1], 0.0)); //Fails } ``` It seems to be recently introduced issue. I upgraded from DMD 2.096 to DMD 2.098 and stumbled upon it. Probably related to this issue https://issues.dlang.org/show_bug.cgi?id=22583
Comment #1 by naydef — 2021-12-13T12:22:48Z
Thanks to Herringway, managed to reduce the issue to appender: ``` import std.math; import std.array; import std.stdio; void main() @safe { auto x = appender!(float[2][])(); x ~= staticArray([0.0f, 0.0f]); writefln("Data: %s", x.data); assert(isClose(x.data[0][1], 0.0)); } ```
Comment #2 by dkorpel — 2021-12-13T13:03:48Z
*** This issue has been marked as a duplicate of issue 22163 ***