June 07, 2022
https://issues.dlang.org/show_bug.cgi?id=23166

          Issue ID: 23166
           Summary: seg fault when compiling with -inline
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: bugzilla@digitalmars.com

The following:

bool __equals(scope const char[] lhs, scope const char[] rhs)
{
    if (lhs.length != rhs.length)
        return false;

    {
        import core.stdc.string : memcmp;
        return lhs.length == 0;
    }
    return true;
}

int test(string type)
{
    return __equals(type, "as-is");
}

generates a seg fault when compiling with -inline. The seg fault is on line 4008 of e2ir.d:

    switch (e.op)

The import statement appears to be the trigger.

--