October 04, 2023
https://issues.dlang.org/show_bug.cgi?id=24174

          Issue ID: 24174
           Summary: [CTFE] goto within with statements & catch blocks
                    cause a infinite loop
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: info@lapyst.by

Found a severe bug inside the CTFE engine, that completly stalls the compiler when two local gotos are used inside a with-statement or catch blocks:
---
bool func1() {
    struct BtMatcher {
        uint pc = 0;
    }
    BtMatcher matcher;
    with (matcher) {
        goto StartLoop;
        StartLoop:
        goto SecondLabel;
        SecondLabel:
        return true;
    }
}

bool func2() {
    try {
        throw new Exception("a");
        return true;
    } catch (Exception e) {
        goto StartA;
        StartA:
        goto StartB;
        StartB:
        return false;
    }
}

// Either of these will put dmd into a endless loop
pragma(msg, func1());
pragma(msg, func2());

void main() {}
---

--