Thread overview
[Issue 24440] [REG 2.107] multiple multidimensional array appends broke in 2.107
[Issue 24440] multiple multidimensional array appends broke in 2.107 on Windows
Mar 17, 2024
Ivan Kazmenko
Mar 17, 2024
Ivan Kazmenko
[Issue 24440] [REG 2.107] multiple multidimensional array appends broke in 2.107 on Windows
Mar 17, 2024
Ivan Kazmenko
Mar 31, 2024
Ivan Kazmenko
Mar 31, 2024
Ivan Kazmenko
Mar 31, 2024
Ivan Kazmenko
Mar 31, 2024
Ivan Kazmenko
Apr 19, 2024
Yui Hosaka
Apr 19, 2024
Tim
Apr 19, 2024
Tim
March 17, 2024
https://issues.dlang.org/show_bug.cgi?id=24440

--- Comment #1 from Ivan Kazmenko <gassa@mail.ru> ---
Created attachment 1911
  --> https://issues.dlang.org/attachment.cgi?id=1911&action=edit
reduced example

--
March 17, 2024
https://issues.dlang.org/show_bug.cgi?id=24440

Ivan Kazmenko <gassa@mail.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gassa@mail.ru

--
March 17, 2024
https://issues.dlang.org/show_bug.cgi?id=24440

Ivan Kazmenko <gassa@mail.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|multiple multidimensional   |[REG 2.107] multiple
                   |array appends broke in      |multidimensional array
                   |2.107 on Windows            |appends broke in 2.107 on
                   |                            |Windows

--
March 31, 2024
https://issues.dlang.org/show_bug.cgi?id=24440

--- Comment #2 from Ivan Kazmenko <gassa@mail.ru> ---
With Linux, it's just "segmentation fault" with 2.107.
Correctly goes to assert(false) with 2.106.

--
March 31, 2024
https://issues.dlang.org/show_bug.cgi?id=24440

Ivan Kazmenko <gassa@mail.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[REG 2.107] multiple        |[REG 2.107] multiple
                   |multidimensional array      |multidimensional array
                   |appends broke in 2.107 on   |appends broke in 2.107
                   |Windows                     |

--
March 31, 2024
https://issues.dlang.org/show_bug.cgi?id=24440

Ivan Kazmenko <gassa@mail.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|Windows                     |All

--
March 31, 2024
https://issues.dlang.org/show_bug.cgi?id=24440

--- Comment #3 from Ivan Kazmenko <gassa@mail.ru> ---
Originally got hit by it in my toy language project which I use to teach
parallel computing.
It maintains a three-dimensional array to store queues of messages between
different simulated processes.

For now, circumvented the issue by transforming it to a two-dimensional array of structs containing arrays. https://github.com/GassaFM/interpr/commit/b959bb7870

Still, multidimensional arrays are a pretty core language feature. Can I expect it would work again at some point?..

Ivan Kazmenko.

--
April 19, 2024
https://issues.dlang.org/show_bug.cgi?id=24440

Yui Hosaka <hos@hos.ac> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hos@hos.ac

--- Comment #4 from Yui Hosaka <hos@hos.ac> ---
Sorry if this is unrelated, but I'm trying to add an example with similar behavior. The following code, given `1000 1000` on the first line and 1000 tokens in each of the subsequence 1000 lines from standard input, fails to run successfully and it is just "Segmentation fault" (DMD>=2.107.0, WSL2).


```
import std.conv, std.stdio, std.string;

void main() {
  string[] tokens = readln.chomp.split;
  const M = tokens[0].to!int;
  const N = tokens[1].to!int;
  auto A = new string[][](M, N);
  foreach (x; 0 .. M) {
    tokens = readln.chomp.split;
    foreach (y; 0 .. N) {
      A[x][y] = tokens[y];
    }
  }
}
```

For further info, I found this at when solving a problem at
https://yukicoder.me/ - my submission link:
https://yukicoder.me/submissions/974786 where I see that when the input is
smaller the segmentation fault does not happen (RE (Runtime Error) vs WA (Wrong
Answer)).

--
April 19, 2024
https://issues.dlang.org/show_bug.cgi?id=24440

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> ---
This looks like the same problem as in issue 24498. The expression `new long [][][](n, n)` creates memory, which is not scanned by the GC, but contains pointers. The GC will free the inner arrays and the program crashes, when they are accessed.

--
April 19, 2024
https://issues.dlang.org/show_bug.cgi?id=24440

Tim <tim.dlang@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #6 from Tim <tim.dlang@t-online.de> ---


*** This issue has been marked as a duplicate of issue 24498 ***

--