[Issue 12342] New: Deprecate not reachable code?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 10 15:01:49 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12342

           Summary: Deprecate not reachable code?
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2014-03-10 15:01:46 PDT ---
int foo() {
    int x = 0;
    goto exit;
    if (true)
        x++;
    x = 20;
exit:
    return x;
}
void main() {}


dmd 2.066alpha gives:

test2.d(4,5): Warning: statement is not reachable
test2.d(6,5): Warning: statement is not reachable

Perhaps it's a good idea to turn such warnings into deprecation messages.


This deprecation avoids cases like a famous bug:
http://en.wikipedia.org/wiki/Backdoor_%28computing%29

>In late February 2014, Apple elliptically notified users of their OS of the "goto fail" backdoor that was caused by an error. This error voids the SSL authentication process, and exposes the user to a Man-in-the-middle attack.[12][13][14] The "goto fail" bug is nicely diff-listed by Arthur in the Guardian expose.[14]<

http://www.theguardian.com/technology/2014/feb/25/apples-ssl-iphone-vulnerability-how-did-it-happen-and-what-next

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list