[Issue 20460] New: Stack traces on OSX show wrong file / line

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 20 15:01:53 UTC 2019


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

          Issue ID: 20460
           Summary: Stack traces on OSX show wrong file / line
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: pro.mathias.lang at gmail.com

To reproduce:
- Add an assert(0) anywhere in DMD in a code path that will be triggered;
- Compile dmd
- Run it on some source code that triggers the assert:

In my case I used:
```
diff --git a/src/dmd/expressionsem.d b/src/dmd/expressionsem.d
index 577ae7abe..a18ecfbb6 100644
--- a/src/dmd/expressionsem.d
+++ b/src/dmd/expressionsem.d
@@ -392,6 +392,9 @@ private Expression searchUFCS(Scope* sc, UnaExp ue,
Identifier ident)
     //printf("searchUFCS(ident = %s)\n", ident.toChars());
     Loc loc = ue.loc;

+    if (sc || !sc)
+        assert(0);
+
     // TODO: merge with Scope.search.searchScopes()
     Dsymbol searchScopes(int flags)
     {
```

Test file:
```
int foo;
void bar(int) {}
void main()
{
    foo.bar;
}
```

Result:
```
% ./generated/osx/release/64/dmd -run wysig.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.089.1-333-g403f33603-dirty
predefs   DigitalMars Posix OSX CppRuntime_Clang darwin 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 D_ObjectiveC
binary    ./generated/osx/release/64/dmd
version   v2.089.1-333-g403f33603-dirty
config    ./generated/osx/release/64/dmd.conf
DFLAGS    -I./generated/osx/release/64/../../../../../druntime/import
-I./generated/osx/release/64/../../../../../phobos
-L-L./generated/osx/release/64/../../../../../phobos/generated/osx/release/64
-fPIC
---
core.exception.AssertError at dmd/expressionsem.d(396): Assertion failure
----------------
??:? _d_assertp [0x1082169fd]
dmd/access.d:394 dmd.expression.Expression
dmd.expressionsem.searchUFCS(dmd.dscope.Scope*, dmd.expression.UnaExp,
dmd.identifier.Identifier) [0x108010c70]
dmd/access.d:394 dmd.expression.Expression
dmd.expressionsem.resolveUFCSProperties(dmd.dscope.Scope*,
dmd.expression.Expression, dmd.expression.Expression) [0x1080115f8]
dmd/access.d:394 _ZN25ExpressionSemanticVisitor5visitEP8DotIdExp [0x1080232f4]
dmd/access.d:394 _ZN8DotIdExp6acceptEP7Visitor [0x1080092a9]
dmd/access.d:394 _Z18expressionSemanticP10ExpressionP5Scope [0x10803386b]
dmd/access.d:394 _ZN24StatementSemanticVisitor5visitEP12ExpStatement
[0x1080d86a9]
dmd/access.d:394 _ZN12ExpStatement6acceptEP7Visitor [0x1080d3f11]
dmd/access.d:394 _Z17statementSemanticP9StatementP5Scope [0x1080d858b]
dmd/access.d:394 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement
[0x1080d896f]
dmd/access.d:394 _ZN17CompoundStatement6acceptEP7Visitor [0x1080d4889]
dmd/access.d:394 _Z17statementSemanticP9StatementP5Scope [0x1080d858b]
dmd/access.d:394 _ZN16Semantic3Visitor5visitEP15FuncDeclaration [0x1080ce365]
dmd/access.d:394 _ZN15FuncDeclaration6acceptEP7Visitor [0x10803c399]
dmd/access.d:394 _Z9semantic3P7DsymbolP5Scope [0x1080ccbd1]
dmd/access.d:394 _ZN16Semantic3Visitor5visitEP6Module [0x1080ccfd7]
dmd/access.d:394 _ZN6Module6acceptEP7Visitor [0x107fb1369]
dmd/access.d:394 _Z9semantic3P7DsymbolP5Scope [0x1080ccbd1]
dmd/access.d:394 int dmd.mars.tryMain(ulong, const(char)**, ref
dmd.globals.Param) [0x10808f2e9]
dmd/access.d:394 _Dmain [0x1080908fd]
```

Notice the repetitive dmd/access.d

--


More information about the Digitalmars-d-bugs mailing list