You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SR-6749 Describing the "masking shift" operations in terms of bit-masks is not always correct
Issue Description:
Summary:
When creating an UnsignedIntegerType conforming data type, the compiler's optimization check methods are causing the compile to fail even though the conforming type handles all truncation possibilities. If I stage my shifts, it works fine. As in 'let variable: UInt128 = (1 << 63) << 1' works, though 'let variable: UInt128 = 1 << 64' does not.
Steps to Reproduce:
Create a new OS X command line project and copy the contents of the attached main.swift over the templated main.swift.
Edit the scheme for run to be release instead of debug.
With line 820 uncommented, "Shift amount is greater than or equal to type size in bits" error will happen during compiling. With it commented, there is no error.
Expected Results:
Line 820 should work. My <<(:🙂 operator correctly handles the rhs == 64 case by preventing a bit shift on the underlying UInt64 type by 64 bits. It's a completely safe operation.
Actual Results:
I get a "Shift amount is greater than or equal to type size in bits" error on my init(_builtinIntegerLiteral value: _MaxBuiltinIntegerType) initializer when it tries to convert the integer literal.
Configuration:
This only occurs on a release build. Debug builds have no issue.
The text was updated successfully, but these errors were encountered:
Attachment: Download
Environment
Xcode 7.2.1
OS X 10.11.2
Additional Detail from JIRA
md5: 7f0ac12a312a3180f646410488c31fe9
relates to:
Issue Description:
Summary:
When creating an UnsignedIntegerType conforming data type, the compiler's optimization check methods are causing the compile to fail even though the conforming type handles all truncation possibilities. If I stage my shifts, it works fine. As in 'let variable: UInt128 = (1 << 63) << 1' works, though 'let variable: UInt128 = 1 << 64' does not.
Steps to Reproduce:
Expected Results:
Line 820 should work. My <<(:🙂 operator correctly handles the rhs == 64 case by preventing a bit shift on the underlying UInt64 type by 64 bits. It's a completely safe operation.
Actual Results:
I get a "Shift amount is greater than or equal to type size in bits" error on my init(_builtinIntegerLiteral value: _MaxBuiltinIntegerType) initializer when it tries to convert the integer literal.
Configuration:
This only occurs on a release build. Debug builds have no issue.
The text was updated successfully, but these errors were encountered: