https://llvm.org/bugs/show_bug.cgi?id=27334
Bug ID: 27334 Summary: Left shifting beyond sizeof int seems to have no effect. Product: clang Version: unspecified Hardware: Macintosh OS: MacOS X Status: NEW Severity: normal Priority: P Component: C++ Assignee: unassignedclangb...@nondot.org Reporter: norman.wil...@gmail.com CC: dgre...@apple.com, llvm-bugs@lists.llvm.org Classification: Unclassified Best way to describe is show the code. #include <cassert> #include <iostream> int main() { int count = sizeof(unsigned) * 8; unsigned x = (~0x0u) << count; std::cout << std::hex << x << std::endl; assert(x == 0); } I'd have thought that this shifting would result in x being zero or is this undefined behaviour? This is using the following version: bash-3.2$ clang++ --version Apple LLVM version 7.0.2 (clang-700.1.81) Target: x86_64-apple-darwin15.3.0 Thread model: posix -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs