This PR https://github.com/dlang/dmd/pull/6998
Altered the original fail12485.d test, as it now only fails to compile due to OOM.
---
void dorecursive()
{
recursive([0]);
}
void recursive(R)(R r)
{
import std.algorithm;
recursive( r.filter!(e=>true) );
}
---
Test needs reducing to not import phobos, but otherwise there should be no reason why a slowdown in compilation should occur (or infinite recursion?), nor should it be causing OOM either.
Bottom of backtrace proves that it is indeed infinite recursion, so the PR caused a regression.
---
#6127 0x00005555559ed23c in statementSemantic(Statement*, Scope*) (s=0x7ffff7b165d0, sc=0x7ffff72dc8c0) at
src/dmd/statementsem.d:132
#6128 0x00005555559e2f4f in Semantic3Visitor::visit(FuncDeclaration*) (this=0x7fffffffd170, funcdecl=0x7ff
ff7b161b0) at src/dmd/semantic3.d:572
#6129 0x00005555559419ae in FuncDeclaration::accept(Visitor*) (this=0x7ffff7b161b0, v=0x7fffffffd170) at s
rc/dmd/func.d:2569
#6130 0x00005555559e1a5a in semantic3(Dsymbol*, Scope*) (dsym=0x7ffff7b161b0, sc=0x7ffff72dc5b0) at src/dm
d/semantic3.d:81
#6131 0x00005555559e1e54 in Semantic3Visitor::visit(Module*) (this=0x7fffffffd220, mod=0x7ffff7b14d80) at
src/dmd/semantic3.d:194
#6132 0x00005555558af2da in Module::accept(Visitor*) (this=0x7ffff7b14d80, v=0x7fffffffd220) at src/dmd/dm
odule.d:1485
#6133 0x00005555559e1a5a in semantic3(Dsymbol*, Scope*) (dsym=0x7ffff7b14d80, sc=0x0) at src/dmd/semantic3
.d:81
#6134 0x000055555599999e in dmd.mars.tryMain(ulong, const(char)**, ref dmd.globals.Param) (params=..., arg
v=0x7fffffffdd68, argc=2) at src/dmd/mars.d:579
#6135 0x000055555599b11d in D main (_param_0=...) at src/dmd/mars.d:972
Comment #3 by r.sagitario — 2020-12-25T11:40:06Z
I don't get OOM with the test, but the 64-bit compiler needs about 2.6 GB to hit the template recursion limit (dmd 2.094.2). With -lowmem, a mere 320 MB is needed.
I doubt the mangler is to blame here, it just happens to execute the failing memory allocation during the infinite recursion in your case.
fail12485.d was tweaked to avoid the memory and template recursion limit in order still test the symbol length limit. This was hit way earlier before due to the large mangled names.
Comment #4 by robert.schadek — 2024-12-13T19:13:36Z