Bug 23614 - switch (5.3) { case 5: print("FAIL!"); default: }
Summary: switch (5.3) { case 5: print("FAIL!"); default: }
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Gavin Barraclough
URL:
Keywords: HasReduction, InRadar
Depends on:
Blocks:
 
Reported: 2009-01-29 00:08 PST by Zoltan Herczeg
Modified: 2009-02-26 19:32 PST (History)
1 user (show)

See Also:


Attachments
The patch (2.62 KB, patch)
2009-02-26 18:28 PST, Gavin Barraclough
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zoltan Herczeg 2009-01-29 00:08:00 PST
The quickfix of bug #23469 is introduced a new bug. AP said I should open a new bug report for this.

This is a copy of my comment:

var a = 5.3

    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.3 to 5, which
is wrong in this case!
Comment 1 Mark Rowe (bdash) 2009-01-29 00:42:08 PST
<rdar://problem/6538908>
Comment 2 Gavin Barraclough 2009-02-26 18:28:10 PST
Created attachment 28058 [details]
The patch
Comment 3 Geoffrey Garen 2009-02-26 18:30:38 PST
Comment on attachment 28058 [details]
The patch

r=me with layout test please
Comment 4 Gavin Barraclough 2009-02-26 19:32:55 PST
Sending        JavaScriptCore/ChangeLog
Sending        JavaScriptCore/interpreter/Interpreter.cpp
Sending        JavaScriptCore/jit/JITStubs.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 41277.