[llvm] 31d3c0b - [ADT] Fix Wshift-overflow gcc warning in isPowerOf2 unit test
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 18 09:01:00 PDT 2021
Author: Simon Pilgrim
Date: 2021-10-18T17:00:36+01:00
New Revision: 31d3c0b33310ef17df3bbd47bd832d61b8155d1e
URL: https://github.com/llvm/llvm-project/commit/31d3c0b33310ef17df3bbd47bd832d61b8155d1e
DIFF: https://github.com/llvm/llvm-project/commit/31d3c0b33310ef17df3bbd47bd832d61b8155d1e.diff
LOG: [ADT] Fix Wshift-overflow gcc warning in isPowerOf2 unit test
Added:
Modified:
llvm/unittests/ADT/APIntTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp
index 3631c126718a..0efe28f111ca 100644
--- a/llvm/unittests/ADT/APIntTest.cpp
+++ b/llvm/unittests/ADT/APIntTest.cpp
@@ -1769,7 +1769,7 @@ TEST(APIntTest, isPowerOf2) {
EXPECT_FALSE(APInt(5, 0x00).isPowerOf2());
EXPECT_FALSE(APInt(32, 0x11).isPowerOf2());
EXPECT_TRUE(APInt(17, 0x01).isPowerOf2());
- EXPECT_TRUE(APInt(32, 0xff << 31).isPowerOf2());
+ EXPECT_TRUE(APInt(32, (unsigned)(0xffu << 31)).isPowerOf2());
for (int N : {1, 2, 3, 4, 7, 8, 16, 32, 64, 127, 128, 129, 256}) {
EXPECT_FALSE(APInt(N, 0).isPowerOf2());
More information about the llvm-commits
mailing list