[Issue 24498] New: Multidimensional array not scanned by GC
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Apr 13 17:31:43 UTC 2024
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 at puremagic.com
Reporter: tim.dlang at 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.
--
More information about the Digitalmars-d-bugs
mailing list