[Issue 22524] New: DMD segfault after S.sizeof error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 18 19:19:40 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22524

          Issue ID: 22524
           Summary: DMD segfault after S.sizeof error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dkorpel at live.nl

```
void segfault(int x)
{
        auto m = S.yyy;
        () {
                return fun(x, m);
        };
}

void fun(int y, int z) {}

```

segf.d(4): Error: undefined identifier `S`
[1]    85067 segmentation fault  dmd segf.d

gdb:

Program received signal SIGSEGV, Segmentation fault.
0x0000555555a4627c in typeSemantic(Type*, Loc const&, Scope*) (type=0x0,
loc=..., sc=0x7ffff72dc6b0) at src/dmd/typesem.d:2202
2202        switch (type.ty)

Backtrace:

typeSemantic(Type*, Loc const&, Scope*)             src/dmd/typesem.d:2202
dmd.typesem.typeSemantic(...)                       src/dmd/typesem.d:1662
typeSemantic(Type*, Loc const&, Scope*)             src/dmd/typesem.d:2212
ExpressionSemanticVisitor::visit(FuncExp*)         
src/dmd/expressionsem.d:4091
FuncExp::accept(Visitor*)                           src/dmd/expression.d:4046
expressionSemantic(Expression*, Scope*)            
src/dmd/expressionsem.d:12017
StatementSemanticVisitor::visit(ExpStatement*)      src/dmd/statementsem.d:201
ExpStatement::accept(Visitor*)                      src/dmd/statement.d:478
statementSemantic(Statement*, Scope*)               src/dmd/statementsem.d:143
StatementSemanticVisitor::visit(CompoundStatement*) src/dmd/statementsem.d:262
CompoundStatement::accept(Visitor*)                 src/dmd/statement.d:621
statementSemantic(Statement*, Scope*)               src/dmd/statementsem.d:143
Semantic3Visitor::visit(FuncDeclaration*)           src/dmd/semantic3.d:582
FuncDeclaration::accept(Visitor*)                   src/dmd/func.d:2678
semantic3(Dsymbol*, Scope*)                         src/dmd/semantic3.d:82

Looks like it's attempting typeSemantic on a that's null because of the error.

--


More information about the Digitalmars-d-bugs mailing list