In http://reviews.llvm.org/D8899#153339, @chandlerc wrote:
> This doesn't seem correct for a negative LHS where we only shift out 1s -- I > think that should be valid. > > Essentially, we seem to have a strange circumstance here where NUW as > specified is not a subset of the restrictions of NSW. Negative LHS is forbidden in both C11 and C++14. C11 6.5.7p4: If E1 has a signed type and nonnegative value, and E1 × 2**E2 is representable in the result type, then that is the resulting value; otherwise, the behavior is undefined. C++14 [expr.shift]p2: Otherwise, if E1 has a signed type and non-negative value, and E1 × 2**E2 is representable in the corresponding unsigned type of the result type, then that value, converted to the result type, is the resulting value; otherwise, the behavior is undefined. http://reviews.llvm.org/D8899 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
