RESOLVED FIXED 23469
switch (-1 * 0) { default: print("FAIL!"); case 0: }
https://bugs.webkit.org/show_bug.cgi?id=23469
Summary switch (-1 * 0) { default: print("FAIL!"); case 0: }
Gavin Barraclough
Reported 2009-01-21 19:06:25 PST
FAIL!
Attachments
The patch (2.15 KB, patch)
2009-01-21 19:52 PST, Gavin Barraclough
no flags
Typo fix (2.15 KB, patch)
2009-01-21 20:01 PST, Gavin Barraclough
oliver: review+
Mark Rowe (bdash)
Comment 1 2009-01-21 19:14:38 PST
Do we really add an exclamation point out of nowhere?
Gavin Barraclough
Comment 2 2009-01-21 19:52:53 PST
Created attachment 26920 [details] The patch
Gavin Barraclough
Comment 3 2009-01-21 20:01:44 PST
Created attachment 26921 [details] Typo fix
Oliver Hunt
Comment 4 2009-01-21 20:09:03 PST
Comment on attachment 26921 [details] Typo fix r=me, as long as there is a testcase
Gavin Barraclough
Comment 5 2009-01-21 20:28:49 PST
Sending JavaScriptCore/ChangeLog Sending JavaScriptCore/interpreter/Interpreter.cpp Sending LayoutTests/ChangeLog Sending LayoutTests/fast/js/resources/switch-behaviour.js Sending LayoutTests/fast/js/switch-behaviour-expected.txt Transmitting file data ..... Committed revision 40111.
Zoltan Herczeg
Comment 6 2009-01-27 01:20:07 PST
Hi, the fix of this bug introduces a new bug. Consider the following code: var a = 5.4 switch(val) { case 1: return 10 case 2: return 11 case 3: return 12 case 5: return 14 case 6: return 15 default: return 100 } The switch selects "case 5", because numberToInt32() converts 5.4 to 5, which is wrong in this case! The right test should be something like this in case of scrutinee is a double value: if ((double)((int)scrutinee) == scrutinee) ... ctiForValue((int)scrutinee)
Alexey Proskuryakov
Comment 7 2009-01-28 14:52:02 PST
Could you please file a new bug for this?
Note You need to log in before you can comment on or make changes to this bug.