Bug 8052 – Spurious warning when exiting out of a labeled Do-While

Status
REOPENED
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-05-06T04:06:47Z
Last change time
2024-12-13T17:59:51Z
Keywords
diagnostic, rejects-valid
Assigned to
No Owner
Creator
kekeniro2
Moved to GitHub: dmd#17549 →

Comments

Comment #0 by kekeniro2 — 2012-05-06T04:06:47Z
Building the following code, I get an incorrect warning. int test() { loop: do { break loop; } while(false); return 0; // isn't unreachable. } ----------------------------------- Warning: statement is not reachable D1 does not warn.
Comment #1 by callumenator — 2014-07-28T05:46:55Z
No warning given with dmd 2.065, or earlier at 2.061.
Comment #2 by jiki — 2014-07-28T06:03:11Z
No. '-w' option is required to reproduce, I've missed it. Anyway, I change the Severity to minor.
Comment #3 by dragoscarp — 2014-07-30T14:36:03Z
The same bug without label (see bug 13201): ------------------------------ void foo() { } void main() { while (true) { do { foo; break; } while (true); break; } }
Comment #4 by jiki — 2016-02-10T01:50:15Z
I hit this again. The bug seems a careless bit operation. Location: statement.d Statement.blockExit() BlockExit.visit(DoStatement) Code: if (result == BEbreak) // '==' should be '&' ... if (result & BEcontinue) ... I wanted to make a PR, but I don't see how the other flags work.
Comment #5 by schveiguy — 2023-11-14T17:32:15Z
We have removed the unreachable statement warning https://github.com/dlang/dmd/pull/15568 I think this should be closed.
Comment #6 by robert.schadek — 2024-12-13T17:59:51Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17549 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB