digitalmars.D.bugs - [Issue 7232] New: Warning: statement is not reachable has no line number
- d-bugmail puremagic.com (28/28) Jan 05 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7232
- d-bugmail puremagic.com (28/28) Jan 06 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7232
- d-bugmail puremagic.com (19/19) Jan 06 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7232
- d-bugmail puremagic.com (6/6) Jan 06 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7232
- d-bugmail puremagic.com (13/13) Jan 06 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7232
http://d.puremagic.com/issues/show_bug.cgi?id=7232 Summary: Warning: statement is not reachable has no line number Product: D Version: D2 Platform: Other OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: robert octarineparrot.com 15:52:33 GMT --- When the following is compiled with -w or -wi, it will give a warning without a line number ---- bool addArticle() { scope(failure) return false; return true; } ---- Tested on dmd 2.057 on OS X 64 and Ubuntu 32. $ dmd -w test.d Warning: statement is not reachable -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 05 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7232 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch https://github.com/D-Programming-Language/dmd/pull/610 In addArticle function, dmd translates the body code like follows: try { return true; } catch (Throwable __o) { return false; } After my patch, the translation result would change like follows: try { return true; } catch (Throwable __o) { return false; // this statement never fall through next. // so next unreachable rethrowing is implicitly removed. } Finally, original warning would never be generated. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 06 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7232 Technical note: Maybe, the original issue by Robert Clipsham is "unreachable scope(failure) should warn "statement is not reachable" _with line number_. But today it is technically enhancement. Because: 1. Current D2 dmd does only check Exception throwing possibilities in flow analysis. That means Throwable is not the target of the analysis. In above code, scope(failure) return false; return true; // (a) dmd does not consider the statement (a) throws Throwable or not. 2. scope(failure) catches Throwable object and rethrow it. Therefore the scope(failure) statement is always analysed as *may be reachable*. From the two reasons, current dmd cannot detect that the `scope(failure) return false;` is not reachable. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 06 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7232 Posted bug 7240 as an enhancement. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 06 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7232 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED 13:30:16 PST --- https://github.com/D-Programming-Language/dmd/commit/458065293bd4cf990fb99bcd01fc294e7df21c17 https://github.com/D-Programming-Language/dmd/commit/986404479ea9eac7a9caa32be1f92c22a8aee38a -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 06 2012