www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 431] New: Invalid case selected when switching on a long

reply d-bugmail puremagic.com writes:
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)


-- 
Oct 12 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=431






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.


-- 
Oct 16 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=431


bugzilla digitalmars.com changed:

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





Fixed DMD 0.170


-- 
Oct 18 2006
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- iD8DBQFFOibcLK5blCcjpWoRAs01AJwNXyOUfDvxNKqj+QnQg9NvlX8C/wCfS15L aLZz9RGx0DM+hTq+eH+55uw= =oRzi -----END PGP SIGNATURE-----
Oct 21 2006