April 13 [Issue 24498] New: Multidimensional array not scanned by GC | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24498 Issue ID: 24498 Summary: Multidimensional array not scanned by GC Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: regression Priority: P1 Component: druntime Assignee: nobody@puremagic.com Reporter: tim.dlang@t-online.de This is similar to issue 24436: ``` import std.stdio, core.memory; void main() { int[][][] a = new int[][][](2, 2); assert(!(GC.getAttr(a[0].ptr) & GC.BlkAttr.NO_SCAN)); // fails now } ``` The array has three dimensions, but only two are initialized. The middle arrays need to be scanned by the GC, but they are marked as NO_SCAN. The problem exists since https://github.com/dlang/dmd/commit/055accfbe6afe5f72c77617d54f737e71e29f5a3 A similar problem has already been solved in https://github.com/dlang/dmd/pull/16373 The initialization is lowered to _d_newarraymTX!(int[][][], int, int[][]). Maybe this should be _d_newarraymTX!(int[][][], int[], int[][]) instead, because the element type of the array should be int[] and not int. -- |
Copyright © 1999-2021 by the D Language Foundation