[Issue 22629] New: inlining affects assert messages with -checkaction=C

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 26 02:40:45 UTC 2021


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

          Issue ID: 22629
           Summary: inlining affects assert messages with -checkaction=C
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: duser at airmail.cc

---
void main()
{
        mydata data;
        assert(check(&data));
}

struct mydata
{
        int a, b, c;
}

bool check(mydata* p)
{
        return p.a == 1 && p.b == 2 && p.c == 3;
}
---

% dmd -checkaction=C -run asserttest.d
dmd_runzAP3V1: asserttest.d:4: Assertion `check(& data)' failed.

% dmd -inline -checkaction=C -run asserttest.d
dmd_runJ6qb9y: asserttest.d:12: Assertion `(mydata* p = & data;) , (*p).a == 1
&& ((*p).b == 2) && ((*p).c == 3)' failed.

two problems with the output:
- the line number of the assert statement is replaced with the line number of
the inlined code
- the original expression in the message is replaced with the inlined
function's contents

--


More information about the Digitalmars-d-bugs mailing list