[Issue 21008] dmd segfaults because of __traits(getMember, ...) and virtual function overriding

2022-03-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21008

Dlang Bot  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Dlang Bot  ---
dlang/dmd pull request #13724 "fix Issue 21008 - dmd segfaults because of
__traits(getMember, ...) a…" was merged into master:

- 088d11bb2497c7ca4a6d58652f940a643fc95a39 by Walter Bright:
  fix Issue 21008 - dmd segfaults because of __traits(getMember, ...) and
virtual function overriding

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

--


[Issue 21008] dmd segfaults because of __traits(getMember, ...) and virtual function overriding

2022-02-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21008

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #4 from Dlang Bot  ---
@WalterBright created dlang/dmd pull request #13724 "fix Issue 21008 - dmd
segfaults because of __traits(getMember, ...) a…" fixing this issue:

- fix Issue 21008 - dmd segfaults because of __traits(getMember, ...) and
virtual function overriding

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

--


[Issue 21008] dmd segfaults because of __traits(getMember, ...) and virtual function overriding

2022-02-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21008

Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com

--- Comment #3 from Walter Bright  ---
Smaller test case (without templates):

class Base
{
bool after();

mixin(handleMiddlewareAnnotation);
}

class C : Base
{
override bool after();
}

string handleMiddlewareAnnotation()
{
foreach (member; __traits(allMembers, C))
{
__traits(getMember, C, member);
}
}

--


[Issue 21008] dmd segfaults because of __traits(getMember, ...) and virtual function overriding

2020-07-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21008

Basile-z  changed:

   What|Removed |Added

   Keywords||ice

--


[Issue 21008] dmd segfaults because of __traits(getMember, ...) and virtual function overriding

2020-07-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21008

--- Comment #2 from moonlightsenti...@disroot.org ---
Slightly different stack trace for current HEAD
(3c8b519cbc30935e0b66d97d04663156bbd3dc63):

core.exception.RangeError@dmd/root/array.d(259): Range violation

??:? _d_arrayboundsp [0x7f1929da2a75]
dmd/root/array.d:259 _ZN5ArrayIP7DsymbolEixEm [0x7f1929be65d6]
dmd/dsymbolsem.d:3724
_ZN22DsymbolSemanticVisitor23funcDeclarationSemanticEP15FuncDeclaration
[0x7f1929b55d7e]
dmd/dsymbolsem.d:4114 _ZN22DsymbolSemanticVisitor5visitEP15FuncDeclaration
[0x7f1929b57194]
dmd/func.d:2558 _ZN15FuncDeclaration6acceptEP7Visitor [0x7f1929bbd8e5]
dmd/dsymbolsem.d:564 _Z15dsymbolSemanticP7DsymbolP5Scope [0x7f1929b4be75]
dmd/typesem.d:4305 dmd.expression.Expression dmd.typesem.dotExp(dmd.mtype.Type,
dmd.dscope.Scope*, dmd.expression.Expression, dmd.identifier.Identifier,
int).visitClass(dmd.mtype.TypeClass) [0x7f1929c8fe5a]
dmd/typesem.d:4350 dmd.expression.Expression dmd.typesem.dotExp(dmd.mtype.Type,
dmd.dscope.Scope*, dmd.expression.Expression, dmd.identifier.Identifier, int)
[0x7f1929c8b346]
dmd/expressionsem.d:11890 dmd.expression.Expression
dmd.expressionsem.semanticY(dmd.expression.DotIdExp, dmd.dscope.Scope*, int)
[0x7f1929bb656f]
dmd/expressionsem.d:6151 _ZN25ExpressionSemanticVisitor5visitEP8DotIdExp
[0x7f1929ba4b55]
dmd/expression.d:4574 _ZN8DotIdExp6acceptEP7Visitor [0x7f1929b8a59d]
dmd/expressionsem.d:11488 _Z18expressionSemanticP10ExpressionP5Scope
[0x7f1929bb4d2f]
dmd/traits.d:1002 dmd.expression.Expression
dmd.traits.semanticTraits(dmd.expression.TraitsExp, dmd.dscope.Scope*)
[0x7f1929c7e029]
dmd/expressionsem.d:5288 _ZN25ExpressionSemanticVisitor5visitEP9TraitsExp
[0x7f1929ba1b6c]
dmd/expression.d:4009 _ZN9TraitsExp6acceptEP7Visitor [0x7f1929b88dd1]
dmd/expressionsem.d:11488 _Z18expressionSemanticP10ExpressionP5Scope
[0x7f1929bb4d2f]
dmd/statementsem.d:186 _ZN24StatementSemanticVisitor5visitEP12ExpStatement
[0x7f1929c669d1]
dmd/statement.d:750 _ZN12ExpStatement6acceptEP7Visitor [0x7f1929c6243d]
dmd/statementsem.d:131 _Z17statementSemanticP9StatementP5Scope [0x7f1929c668bb]
dmd/statementsem.d:244 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement
[0x7f1929c66c93]
dmd/statement.d:938 _ZN17CompoundStatement6acceptEP7Visitor [0x7f1929c62cb9]
dmd/statementsem.d:131 _Z17statementSemanticP9StatementP5Scope [0x7f1929c668bb]
dmd/statementsem.d:445 _ZN24StatementSemanticVisitor5visitEP14ScopeStatement
[0x7f1929c677e1]
dmd/statement.d:1045 _ZN14ScopeStatement6acceptEP7Visitor [0x7f1929c630b9]
dmd/statementsem.d:131 _Z17statementSemanticP9StatementP5Scope [0x7f1929c668bb]
dmd/statementsem.d:419
_ZN24StatementSemanticVisitor5visitEP21UnrolledLoopStatement [0x7f1929c676b1]
dmd/statement.d:1003 _ZN21UnrolledLoopStatement6acceptEP7Visitor
[0x7f1929c62f59]
dmd/statementsem.d:131 _Z17statementSemanticP9StatementP5Scope [0x7f1929c668bb]
dmd/statementsem.d:1165 _ZN24StatementSemanticVisitor5visitEP16ForeachStatement
[0x7f1929c68607]
dmd/statement.d:1320 _ZN16ForeachStatement6acceptEP7Visitor [0x7f1929c638b1]
dmd/statementsem.d:131 _Z17statementSemanticP9StatementP5Scope [0x7f1929c668bb]
dmd/statementsem.d:244 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement
[0x7f1929c66c93]
dmd/statement.d:938 _ZN17CompoundStatement6acceptEP7Visitor [0x7f1929c62cb9]
dmd/statementsem.d:131 _Z17statementSemanticP9StatementP5Scope [0x7f1929c668bb]
dmd/semantic3.d:575 _ZN16Semantic3Visitor5visitEP15FuncDeclaration
[0x7f1929c5c712]
dmd/func.d:2558 _ZN15FuncDeclaration6acceptEP7Visitor [0x7f1929bbd8e5]
dmd/semantic3.d:81 _Z9semantic3P7DsymbolP5Scope [0x7f1929c5b14d]
dmd/func.d:455 _ZN15FuncDeclaration17functionSemantic3Ev [0x7f1929bb85b1]
dmd/func.d:429 _ZN15FuncDeclaration16functionSemanticEv [0x7f1929bb84c6]
dmd/expressionsem.d:918 dmd.expression.Expression
dmd.expressionsem.symbolToExp(dmd.dsymbol.Dsymbol, ref const(dmd.globals.Loc),
dmd.dscope.Scope*, bool) [0x7f1929b932c8]
dmd/expressionsem.d:3331 _ZN25ExpressionSemanticVisitor5visitEP8ScopeExp
[0x7f1929b9a813]
dmd/expression.d:3320 _ZN8ScopeExp6acceptEP7Visitor [0x7f1929b872f9]
dmd/expressionsem.d:11488 _Z18expressionSemanticP10ExpressionP5Scope
[0x7f1929bb4d2f]
dmd/expressionsem.d:101 bool dmd.expressionsem.expressionsToString(ref
dmd.root.outbuffer.OutBuffer, dmd.dscope.Scope*,
dmd.root.array.Array!(dmd.expression.Expression).Array*) [0x7f1929b90e62]
dmd/dsymbolsem.d:2101
_ZN22DsymbolSemanticVisitor9compileItEP18CompileDeclaration [0x7f1929b50ef4]
dmd/dsymbolsem.d:2131 _ZN22DsymbolSemanticVisitor5visitEP18CompileDeclaration
[0x7f1929b5115f]
dmd/attrib.d:1344 _ZN18CompileDeclaration6acceptEP7Visitor [0x7f1929ad31a5]
dmd/dsymbolsem.d:564 _Z15dsymbolSemanticP7DsymbolP5Scope [0x7f1929b4be75]
dmd/dsymbolsem.d:5369 void
dmd.dsymbolsem.DsymbolSemanticVisitor.visit(dmd.dclass.ClassDeclaration).__lambda10!(dmd.dsymbol.Dsymbol).__lambda10(dmd.dsymbol.Dsymbol)
[0x7f1929b5bf0f]
dmd/dsymbol.d:99 void
dmd.dsymbol.foreachDsymbol(dmd.root.array.Array!(dmd.dsymbol.Dsymbol).Array*,

[Issue 21008] dmd segfaults because of __traits(getMember, ...) and virtual function overriding

2020-07-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21008

moonlightsenti...@disroot.org changed:

   What|Removed |Added

 CC||moonlightsentinel@disroot.o
   ||rg
   Hardware|x86 |All

--- Comment #1 from moonlightsenti...@disroot.org ---
Reduced test case:

==
class ControllerBase(T)
{
bool after() {}

mixin(handleMiddlewareAnnotation!T);
}

class DemoController : ControllerBase!DemoController
{
bool after() {}
}

string handleMiddlewareAnnotation(T)()
{
foreach (memberName; __traits(allMembers, T))
__traits(getMember, T, memberName);
}
==

Running a debug dmd yields the following trace:

dmd -c -o- test.d

---
ERROR: This is a compiler bug.
Please report it via https://issues.dlang.org/enter_bug.cgi
with, preferably, a reduced, reproducible example and the information below.
DustMite (https://github.com/CyberShadow/DustMite/wiki) can help with the
reduction.
---
DMD v2.092.1

predefs   DigitalMars Posix linux ELFv1 CRuntime_Glibc CppRuntime_Gcc
LittleEndian D_Version2 all D_SIMD D_InlineAsm_X86_64 X86_64 D_LP64 D_PIC
assert D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat
binary../generated/linux/debug/64/dmd
version   v2.092.1

config../generated/linux/debug/64/dmd.conf
DFLAGS-I../generated/linux/debug/64/../../../../../druntime/import
-I../generated/linux/debug/64/../../../../../phobos
-L-L../generated/linux/debug/64/../../../../../phobos/generated/linux/debug/64
-L--export-dynamic -fPIC
---
core.exception.RangeError@dmd/root/array.d(251): Range violation

??:? _d_arrayboundsp [0x7fc38279b939]
dmd/root/array.d:251 _ZN5ArrayIP7DsymbolEixEm [0x7fc3825e1bda]
dmd/dsymbolsem.d:3724
_ZN22DsymbolSemanticVisitor23funcDeclarationSemanticEP15FuncDeclaration
[0x7fc382551656]
dmd/dsymbolsem.d:4115 _ZN22DsymbolSemanticVisitor5visitEP15FuncDeclaration
[0x7fc382552aa4]
dmd/func.d:2564 _ZN15FuncDeclaration6acceptEP7Visitor [0x7fc3825b900d]
dmd/dsymbolsem.d:564 _Z15dsymbolSemanticP7DsymbolP5Scope [0x7fc38254774d]
dmd/typesem.d:4298 dmd.expression.Expression dmd.typesem.dotExp(dmd.mtype.Type,
dmd.dscope.Scope*, dmd.expression.Expression, dmd.identifier.Identifier,
int).visitClass(dmd.mtype.TypeClass) [0x7fc38268a516]
dmd/typesem.d:4343 dmd.expression.Expression dmd.typesem.dotExp(dmd.mtype.Type,
dmd.dscope.Scope*, dmd.expression.Expression, dmd.identifier.Identifier, int)
[0x7fc382685a02]
dmd/expressionsem.d:11889 dmd.expression.Expression
dmd.expressionsem.semanticY(dmd.expression.DotIdExp, dmd.dscope.Scope*, int)
[0x7fc3825b1cbb]
dmd/expressionsem.d:6150 _ZN25ExpressionSemanticVisitor5visitEP8DotIdExp
[0x7fc3825a02a1]
dmd/expression.d:4577 _ZN8DotIdExp6acceptEP7Visitor [0x7fc382585d59]
dmd/expressionsem.d:11487 _Z18expressionSemanticP10ExpressionP5Scope
[0x7fc3825b047b]
dmd/traits.d:1002 dmd.expression.Expression
dmd.traits.semanticTraits(dmd.expression.TraitsExp, dmd.dscope.Scope*)
[0x7fc38267876d]
dmd/expressionsem.d:5284 _ZN25ExpressionSemanticVisitor5visitEP9TraitsExp
[0x7fc38259d2a8]
dmd/expression.d:4012 _ZN9TraitsExp6acceptEP7Visitor [0x7fc38258458d]
dmd/expressionsem.d:11487 _Z18expressionSemanticP10ExpressionP5Scope
[0x7fc3825b047b]
dmd/statementsem.d:186 _ZN24StatementSemanticVisitor5visitEP12ExpStatement
[0x7fc382661179]
dmd/statement.d:750 _ZN12ExpStatement6acceptEP7Visitor [0x7fc38265cc61]
dmd/statementsem.d:131 _Z17statementSemanticP9StatementP5Scope [0x7fc382661063]
dmd/statementsem.d:244 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement
[0x7fc38266143b]
dmd/statement.d:938 _ZN17CompoundStatement6acceptEP7Visitor [0x7fc38265d4dd]
dmd/statementsem.d:131 _Z17statementSemanticP9StatementP5Scope [0x7fc382661063]
dmd/statementsem.d:445 _ZN24StatementSemanticVisitor5visitEP14ScopeStatement
[0x7fc382661f89]
dmd/statement.d:1045 _ZN14ScopeStatement6acceptEP7Visitor [0x7fc38265d8dd]
dmd/statementsem.d:131 _Z17statementSemanticP9StatementP5Scope [0x7fc382661063]
dmd/statementsem.d:419
_ZN24StatementSemanticVisitor5visitEP21UnrolledLoopStatement [0x7fc382661e59]
dmd/statement.d:1003 _ZN21UnrolledLoopStatement6acceptEP7Visitor
[0x7fc38265d77d]
dmd/statementsem.d:131 _Z17statementSemanticP9StatementP5Scope [0x7fc382661063]
dmd/statementsem.d:1165 _ZN24StatementSemanticVisitor5visitEP16ForeachStatement
[0x7fc382662daf]
dmd/statement.d:1320 _ZN16ForeachStatement6acceptEP7Visitor [0x7fc38265e0d5]
dmd/statementsem.d:131 _Z17statementSemanticP9StatementP5Scope [0x7fc382661063]
dmd/statementsem.d:244 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement
[0x7fc38266143b]
dmd/statement.d:938 _ZN17CompoundStatement6acceptEP7Visitor [0x7fc38265d4dd]
dmd/statementsem.d:131 _Z17statementSemanticP9StatementP5Scope [0x7fc382661063]
dmd/semantic3.d:577