Bug 431 – Invalid case selected when switching on a long

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-10-12T15:21:00Z
Last change time
2014-02-15T13:20:21Z
Keywords
wrong-code
Assigned to
bugzilla
Creator
h3r3tic

Comments

Comment #0 by h3r3tic — 2006-10-12T15:21:19Z
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)
Comment #1 by braddr — 2006-10-16T04:41:43Z
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.
Comment #2 by bugzilla — 2006-10-18T13:30:59Z
Fixed DMD 0.170
Comment #3 by thomas-dloop — 2006-10-21T08:40:34Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] 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-----