Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
March 11 [Issue 24436] a array be overwritten when other array be written | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24436 Adam D. Ruppe <destructionator@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |destructionator@gmail.com --- Comment #1 from Adam D. Ruppe <destructionator@gmail.com> --- I can reproduce, it seems random though; sometimes rebuilding with the same settings works and sometimes doesn't. I feel like I've seen this before too. So definitely some kind of bug here. -- |
April 12 [Issue 24436] a array be overwritten when other array be written | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24436 FeepingCreature <default_357-line@yahoo.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |default_357-line@yahoo.de --- Comment #2 from FeepingCreature <default_357-line@yahoo.de> --- Doesn't seem to be happening on Linux, even over a hundred builds and runs. -- |
April 12 [Issue 24436] a array be overwritten when other array be written | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24436 --- Comment #3 from Adam D. Ruppe <destructionator@gmail.com> --- I had it happen on linux once... -- |
April 12 [Issue 24436] a array be overwritten when other array be written | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24436 --- Comment #4 from FeepingCreature <default_357-line@yahoo.de> --- Huh. With the same build once, or with rebuild once? And how long until it happened? I had the code running in a loop and didn't see it, though I changed the writefln for an assert so maybe that changed it enough that it didn't happen. (Would be weird though.) -- |
April 12 [Issue 24436] a array be overwritten when other array be written | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24436 Tim <tim.dlang@t-online.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tim.dlang@t-online.de --- Comment #5 from Tim <tim.dlang@t-online.de> --- I can reproduce the problem with the Arch Linux package for dmd v2.108.0. The output is a bit different from the bug report: [100, 101],[2, 3] [100, 101],[102, 103] This happens only with the Arch Linux package and not with the tar archive from dlang.org. -- |
April 12 [Issue 24436] a array be overwritten when other array be written | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24436 --- Comment #6 from Tim <tim.dlang@t-online.de> --- Correction: It does not happen with DMD 2.108, but DMD 2.107. I previously made a mistake while updating. The problem happens with DMD 2.107 under Arch Linux with both the package and the tar archive from dlang.org. -- |
April 12 [Issue 24436] a array be overwritten when other array be written | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24436 --- Comment #7 from Tim <tim.dlang@t-online.de> --- The first bad commit seems to be https://github.com/dlang/dmd/commit/055accfbe6afe5f72c77617d54f737e71e29f5a3 The problem does not happen any more since this commit: https://github.com/dlang/dmd/commit/1778ab8876bbee178b098be4baa1e2ad059a1769 -- |
April 12 [Issue 24436] a array be overwritten when other array be written | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24436 Tim <tim.dlang@t-online.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |regression --- Comment #8 from Tim <tim.dlang@t-online.de> --- Unfortunately the second commit has not fixed the problem. It can still be seen with 3x3 arrays. import std.stdio, core.memory; void main() { int[][] array1, array2; array1 = new int[][](3,3); foreach (row; 0 .. 3) { foreach (col; 0 .. 3) { array1[row][col] = col+row*3; } } GC.collect(); array2 = new int[][](3,3); foreach (row; 0 .. 3) { foreach (col; 0 .. 3) { array2[row][col] = 100+col+row*3; } } writefln("%(%s,%)", array1); writefln("%(%s,%)", array2); } DMD 2.106.0: [0, 1, 2],[3, 4, 5],[6, 7, 8] [100, 101, 102],[103, 104, 105],[106, 107, 108] DMD 2.107.1: [100, 101, 102],[103, 104, 105],[6, 7, 8] [100, 101, 102],[103, 104, 105],[106, 107, 108] DMD 2.108.0: [0, 1, 2],[100, 101, 102],[6, 7, 8] [100, 101, 102],[103, 104, 105],[106, 107, 108] -- |
April 13 [Issue 24436] a array be overwritten when other array be written | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24436 --- Comment #9 from Tim <tim.dlang@t-online.de> --- Here is a more direct test: ``` import core.memory; void main() { int[][] array1 = new int[][](2,2); assert(!(GC.getAttr(array1.ptr) & GC.BlkAttr.NO_SCAN)); // fails now assert(GC.getAttr(array1[0].ptr) & GC.BlkAttr.NO_SCAN); // passes int*[][] array2 = new int*[][](2,2); assert(!(GC.getAttr(array2.ptr) & GC.BlkAttr.NO_SCAN)); // passes assert(!(GC.getAttr(array2[0].ptr) & GC.BlkAttr.NO_SCAN)); // passes } ``` The attributes are wrong for the outer array of array1. As a result the GC does not scan it and reuses the memory for the inner arrays. -- |
April 13 [Issue 24436] a array be overwritten when other array be written | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24436 --- Comment #10 from FeepingCreature <default_357-line@yahoo.de> --- Great repro! Yeah that makes it pretty obvious what's happening. I'm on it. -- |
Copyright © 1999-2021 by the D Language Foundation