Summary: | switch (-1 * 0) { default: print("FAIL!"); case 0: } | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Gavin Barraclough <barraclough> | ||||||
Component: | JavaScriptCore | Assignee: | Gavin Barraclough <barraclough> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | zherczeg | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Mac | ||||||||
OS: | OS X 10.5 | ||||||||
Attachments: |
|
Description
Gavin Barraclough
2009-01-21 19:06:25 PST
Do we really add an exclamation point out of nowhere? Created attachment 26920 [details]
The patch
Created attachment 26921 [details]
Typo fix
Comment on attachment 26921 [details]
Typo fix
r=me, as long as there is a testcase
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. 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) Could you please file a new bug for this? |