Thread overview
[Issue 6067] New: switch case fall through crash
May 28, 2011
Robert Persson
May 28, 2011
kennytm@gmail.com
May 28, 2011
Robert Persson
May 28, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6067

           Summary: switch case fall through crash
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: r.k.persson@gmail.com


--- Comment #0 from Robert Persson <r.k.persson@gmail.com> 2011-05-28 04:36:41 PDT ---
The following code crashes when run on dmd 2.053. windbg.exe stays on line "nop3" when debugged and then the program crashes.


int main(string[] argv)
{

    string a="test";
    string b="dummy";

    switch(b) {
        case "nop1": a="apples";
        case "nop2": a="oranges";
        case "nop3": a="bananas";
    }

   return 0;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 28, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6067


kennytm@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kennytm@gmail.com


--- Comment #1 from kennytm@gmail.com 2011-05-28 05:11:01 PDT ---
Isn't it expected? A SwitchError will be thrown when there is no default: case and the switch doesn't match.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 28, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6067


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #2 from bearophile_hugs@eml.cc 2011-05-28 05:34:31 PDT ---
I suggest to compile D code with the -w compiler switch.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 28, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6067


Robert Persson <r.k.persson@gmail.com> changed:

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


--- Comment #3 from Robert Persson <r.k.persson@gmail.com> 2011-05-28 06:38:50 PDT ---
Ah! My c++ damaged brain thought it would fall through, but this behaviour is actually better!

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