[Issue 24174] New: [CTFE] goto within with statements & catch blocks cause a infinite loop
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 4 22:25:14 UTC 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 at puremagic.com
Reporter: info at 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() {}
---
--
More information about the Digitalmars-d-bugs
mailing list