Bug 22688 – Control flow analysis is confused by goto case in loop

Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-01-18T20:59:56Z
Last change time
2024-12-13T19:20:27Z
Assigned to
No Owner
Creator
deadalnix
Moved to GitHub: dmd#18078 →

Comments

Comment #0 by deadalnix — 2022-01-18T20:59:56Z
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.
Comment #1 by robert.schadek — 2024-12-13T19:20:27Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18078 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB