digitalmars.D.bugs - [Issue 24436] New: a array be overwritten when other array be written
- d-bugmail puremagic.com (45/45) Mar 11 https://issues.dlang.org/show_bug.cgi?id=24436
https://issues.dlang.org/show_bug.cgi?id=24436 Issue ID: 24436 Summary: a array be overwritten when other array be written Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: mixedavocado+dlang gmail.com exsample code (DMD64 v2.107.1)(windows 11 Home 22H2) import std.stdio, core.memory; void main() { int[][] array1, array2; array1 = new int[][](2,2); foreach (row; 0 .. 2) { foreach (col; 0 .. 2) { array1[row][col] = col+row*2; } } GC.collect(); array2 = new int[][](2,2); foreach (row; 0 .. 2) { foreach (col; 0 .. 2) { array2[row][col] = 100+col+row*2; } } writefln("%(%s,%)", array1); writefln("%(%s,%)", array2); } expected output [0,1],[2,3] [100,101],[102,103] actual output [102,103],[2,3] [100,101],[102,103] --
Mar 11