Bug 106978 - DFG X86: division in the used-as-int case doesn't correctly check for -2^31/-1
Summary: DFG X86: division in the used-as-int case doesn't correctly check for -2^31/-1
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Michael Saboff
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-01-15 20:59 PST by Michael Saboff
Modified: 2013-01-16 02:26 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Saboff 2013-01-15 20:59:53 PST
From <rdar://problem/13021805>

Try this program:

function foo(a, b) {
    return (a / b) | 0;
}

for (var i = 0; i < 200; ++i)
    print(foo(-2147483647-1, -1));

Expected result: prints -2147483648 200 times.

Actual result: crash.

The reason is that the !nodeUsedAsNumber(node.arithNodeFlags()) case of ArithDiv doesn't correctly handle -2^31/-1.
Comment 1 Michael Saboff 2013-01-15 21:48:28 PST
Committed r139835: <http://trac.webkit.org/changeset/139835>
Comment 2 Dominik Röttsches (drott) 2013-01-16 02:26:18 PST
Expected test results fixed, see bug 106991.