Thread overview
[Issue 21499] Backref mangling implementation causes OOM in some edge cases
Dec 22, 2020
Iain Buclaw
Dec 22, 2020
Iain Buclaw
Dec 22, 2020
Iain Buclaw
Dec 22, 2020
Iain Buclaw
Dec 25, 2020
Rainer Schuetze
December 22, 2020
https://issues.dlang.org/show_bug.cgi?id=21499

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org

--- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Reduced test:
---
void dorecursive()
{
    recursive([]);
}

void recursive(R)(R r)
{
    recursive( r.filter!(e=>true) );
}

template filter(alias predicate)
{
    auto filter(Range)(Range)
    {
        return FilterResult!(predicate, Range)();
    }
}

struct FilterResult(alias pred, Range)
{
    alias R = Range;
    R _input;
}
---

--
December 22, 2020
https://issues.dlang.org/show_bug.cgi?id=21499

--- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> ---
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

--
December 22, 2020
https://issues.dlang.org/show_bug.cgi?id=21499

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |regression

--
December 22, 2020
https://issues.dlang.org/show_bug.cgi?id=21499

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code

--
December 25, 2020
https://issues.dlang.org/show_bug.cgi?id=21499

Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario@gmx.de

--- Comment #3 from Rainer Schuetze <r.sagitario@gmx.de> ---
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.

--
December 13
https://issues.dlang.org/show_bug.cgi?id=21499

--- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19844

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--