Thread overview
[Issue 399] New: -w misses unreacheable "case" statement
Oct 04, 2006
d-bugmail
Oct 04, 2006
BCS
Oct 04, 2006
d-bugmail
Oct 04, 2006
d-bugmail
October 04, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=399

           Summary: -w misses unreacheable "case" statement
           Product: D
           Version: 0.168
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: thomas-dloop@kuehne.cn


# import std.stdio;
#
# int main(char[][] args){
#     switch(args.length){
#         case 2:
#             writefln("case 2");
#             goto case 1000;
#         default:
#             writefln("default");
#             break;
#         case 1000:
#             writefln("case 1000 (reachable)");
#             break;
#         case 3: // line 14
#             writefln("case 3 (statement is not reachable)");
#             break;
#     }
#
#     return 0;
# }

"dmd -w test.d" fails to report lines 14 to 16 as unreachable.


-- 

October 04, 2006
> 
> 
> # import std.stdio;
> # # int main(char[][] args){
> #     switch(args.length){
> #         case 2:
> #             writefln("case 2");
> #             goto case 1000;
> #         default:
> #             writefln("default");
> #             break;
> #         case 1000:
> #             writefln("case 1000 (reachable)");
> #             break;
> #         case 3: // line 14
> #             writefln("case 3 (statement is not reachable)");
> #             break;
> #     }
> # #     return 0;
> # }
> 
> "dmd -w test.d" fails to report lines 14 to 16 as unreachable.
> 
> 

given $test a b

args.length == 3

Or am I missing something??
October 04, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=399


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




------- Comment #1 from bugzilla@digitalmars.com  2006-10-04 14:04 -------
Compiling and running the sample:

  dmd test
  test a b

gives the output:

  case 3 (statement is not reachable)


-- 

October 04, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=399





------- Comment #2 from thomas-dloop@kuehne.cn  2006-10-04 14:07 -------
Sorry for confusing non-D and D grammar.


--