================
@@ -5129,8 +5129,11 @@ void EnumDecl::getValueRange(llvm::APInt &Max, 
llvm::APInt &Min) const {
     unsigned NumBits = std::max(NumNegativeBits, NumPositiveBits + 1);
     Max = llvm::APInt(Bitwidth, 1) << (NumBits - 1);
     Min = -Max;
-  } else {
-    Max = llvm::APInt(Bitwidth, 1) << NumPositiveBits;
+ } else {
+    if (NumPositiveBits >= Bitwidth)
+      Max = llvm::APInt::getZero(Bitwidth);
----------------
ojhunt wrote:

@AaronBallman I'm not sure about this - it matches the functionally expected 
behavior of the old code, but do we really want this to be zero vs `1<<BitWidth 
- 1`? The latter is a more correct "max value" despite the obviously broken 
nature of enum values exceeding the bit width?

https://github.com/llvm/llvm-project/pull/173213
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to