WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
143345
cloop overflow test is broken in recent clang
https://bugs.webkit.org/show_bug.cgi?id=143345
Summary
cloop overflow test is broken in recent clang
Richard O'Grady
Reported
2015-04-02 14:31:25 PDT
cloop.rb's cloopAddOverflowTest() uses this check: "((#{signBit}(b) != #{signBit}(a)) && (#{signBit}(b-a) == #{signBit}(a)))" to detect overflow, and similarly for subtraction. In clang
r221045
, an optimization was introduced which breaks this for the case where we are incrementing a value by 1. Repro on Linux (with clang
r221045
or above): $ CC=clang $ CXX=clang $ build-jsc --cloop --release --gtk Then execute this in jsc: for (var i = 0x7fffffff; i < 0x80000000; i++) {print(i);} Notice that i wraps around to become negative. Using safeAdd() and safeSub() from CheckedArithmetic.h avoids the problem.
Attachments
Add attachment
proposed patch, testcase, etc.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug