Thread overview
[Issue 19661] DMD 2.084.0 SIGSEGV in std.traits.isFunction
Apr 18, 2019
Hiroki Noda
Apr 18, 2019
Basile-z
Apr 18, 2019
Basile-z
Apr 18, 2019
Dlang Bot
Apr 19, 2019
Mike Franklin
Apr 19, 2019
Dlang Bot
Apr 24, 2019
Dlang Bot
Mar 21, 2020
Basile-z
April 18, 2019
https://issues.dlang.org/show_bug.cgi?id=19661

Hiroki Noda <kubo39@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kubo39@gmail.com

--- Comment #1 from Hiroki Noda <kubo39@gmail.com> ---
I tried this in dmd 2.085.1, and got segv too.
`immutable bool testMod = ...` causes stack overflow, however I'm not sure why
`immutable testMod = ...` works...

---
immutable bool testMod = test19661();  // SEGV
// immutable testMod = test19661(); // Can compile and works.
// enum testMod = test19661(); // Error: circular initialization

bool test19661()
{
    import std.traits : isFunction;
    return isFunction!testMod;
}

--
April 18, 2019
https://issues.dlang.org/show_bug.cgi?id=19661

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice
                 CC|                            |b2.temp@gmx.com
           Severity|critical                    |regression

--- Comment #2 from Basile-z <b2.temp@gmx.com> ---
reg 2.084 + ICE

--
April 18, 2019
https://issues.dlang.org/show_bug.cgi?id=19661

--- Comment #3 from Basile-z <b2.temp@gmx.com> ---
There's a recursive template instantiation in dmd.dmangle, in function

  void mangleTemplateInstance(TemplateInstance ti)

which is possible to detect with the ti.inuse variable. Then you ends up with
an assert(0):

> dmd/todt.d:69 void dmd.todt.Initializer_toDt(dmd.init.Initializer, ref dmd.backend.dt.DtBuilder).visitError(dmd.init.ErrorInitializer) [0x6d3736]
> dmd/todt.d:204 _Z16Initializer_toDtP11InitializerR9DtBuilder [0x6d36a5]
> dmd/toobj.d:874 _ZN9toObjFile9ToObjFile15initializerToDtEP14VarDeclarationR9DtBuilder [0x6e13aa]
> dmd/toobj.d:608 _ZN9toObjFile9ToObjFile5visitEP14VarDeclaration [0x6e0a74]
> dmd/declaration.d:1642 _ZN14VarDeclaration6acceptEP7Visitor [0x58243d]
> dmd/toobj.d:1020 _Z9toObjFileP7Dsymbolb [0x6dffbe]
> dmd/glue.d:409 _Z10genObjFileP6Moduleb [0x6d0b13]
> dmd/mars.d:717 int dmd.mars.tryMain(ulong, const(char)**, ref dmd.globals.Param) [0x65d5ea]
> dmd/mars.d:925 _Dmain [0x65e339]

If you remove it finally a bad error message happens (the default one for ErrorExp). So that's not ideal.

> Error: unknown, please file report on issues.dlang.org
> ice19661.d(11,18): Error: template instance `std.traits.isFunction!(testModule)` recursive template instantiation : isFunction!(testModule)
> Error: invalid initializer

There should just be the error related to recursion.

--
April 18, 2019
https://issues.dlang.org/show_bug.cgi?id=19661

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@Basile-z created dlang/dmd pull request #9648 "fix issue 19661 - SIGSEGV in std.traits.isFunction" fixing this issue:

- fix issue 19661 - SIGSEGV in std.traits.isFunction

https://github.com/dlang/dmd/pull/9648

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

Mike Franklin <slavo5150@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |slavo5150@yahoo.com

--- Comment #5 from Mike Franklin <slavo5150@yahoo.com> ---
According to a digger bisection, this PR introduced the regression: https://github.com/dlang/dmd/pull/9069

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

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
@RazvanN7 created dlang/dmd pull request #9652 "Fix Issue 19661 - DMD 2.084.0 SIGSEGV in std.traits.isFunction" fixing this issue:

- Fix Issue 19661 - DMD 2.084.0 SIGSEGV in std.traits.isFunction

https://github.com/dlang/dmd/pull/9652

--
April 24, 2019
https://issues.dlang.org/show_bug.cgi?id=19661

Dlang Bot <dlang-bot@dlang.rocks> changed:

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

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #9652 "Fix Issue 19661 - DMD 2.084.0 SIGSEGV in std.traits.isFunction" was merged into master:

- 7b91b3577641764a079e9af075fd51e9928f4998 by RazvanN7:
  Fix Issue 19661 - DMD 2.084.0 SIGSEGV in std.traits.isFunction

https://github.com/dlang/dmd/pull/9652

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=19661

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--