[Issue 22688] New: Control flow analysis is confused by goto case in loop
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 18 20:59:56 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22688
Issue ID: 22688
Summary: Control flow analysis is confused by goto case in loop
Product: D
Version: D2
Hardware: x86_64
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: deadalnix at gmail.com
See sample code:
int foo(char c) {
while (true) {
switch (c) {
case 'a':
goto default;
default:
return 3;
}
}
}
dmd gives an error:
Error: function `foo` no `return exp;` or `assert(0);` at end of function
As far as i can tell from experiments, dmd assumes that the "goto default"
statement may jump out of the loop. Or something like that.
--
More information about the Digitalmars-d-bugs
mailing list