Thread overview
[Issue 431] New: Invalid case selected when switching on a long
Oct 12, 2006
d-bugmail
Oct 16, 2006
d-bugmail
Oct 18, 2006
d-bugmail
Oct 21, 2006
Thomas Kuehne
October 12, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=431

           Summary: Invalid case selected when switching on a long
           Product: D
           Version: 0.169
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: h3r3tic@mat.uni.torun.pl


void main() {
        long foo = 4;
        switch (foo) {
                case 2: assert (false); break;
                case 3: break;
                case 4: break;
                case 5: break;
        }
}

// Error: AssertError Failure switchbug.d(4)


-- 

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





------- Comment #1 from braddr@puremagic.com  2006-10-16 04:41 -------
I'm unable to reproduce this on linux with dmd recent versions of dmd (166-169).  That points to a windows specific bug.  To confirm that case 4 was being taken, I altered the test case to:

$ cat -n 431.d
     1  void main() {
     2          long foo = 4;
     3          switch (foo) {
     4                  case 2: assert (false, "2"); break;
     5                  case 3: assert (false, "3"); break;
     6                  case 4: assert (false, "4"); break;
     7                  case 5: assert (false, "5"); break;
     8          }
     9  }

$ ./431
Error: AssertError Failure 431.d(6) 4

Before that alteration, it'd run without error.


-- 

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


bugzilla@digitalmars.com changed:

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




------- Comment #2 from bugzilla@digitalmars.com  2006-10-18 13:30 -------
Fixed DMD 0.170


-- 

October 21, 2006
d-bugmail@puremagic.com schrieb am 2006-10-12:
> http://d.puremagic.com/issues/show_bug.cgi?id=431

> void main() {
>         long foo = 4;
>         switch (foo) {
>                 case 2: assert (false); break;
>                 case 3: break;
>                 case 4: break;
>                 case 5: break;
>         }
> }
>
> // Error: AssertError Failure switchbug.d(4)

Added to DStress as http://dstress.kuehne.cn/run/c/case_04_A.d http://dstress.kuehne.cn/run/c/case_04_B.d

Thomas