[llvm] c6f64c5 - Verifier: Don't rely on bitmask enum when checking nofpclass value

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 24 05:39:38 PST 2023


Author: Matt Arsenault
Date: 2023-02-24T09:39:32-04:00
New Revision: c6f64c5d887c3f5aa88515d749bb2a115b8226eb

URL: https://github.com/llvm/llvm-project/commit/c6f64c5d887c3f5aa88515d749bb2a115b8226eb
DIFF: https://github.com/llvm/llvm-project/commit/c6f64c5d887c3f5aa88515d749bb2a115b8226eb.diff

LOG: Verifier: Don't rely on bitmask enum when checking nofpclass value

Added: 
    

Modified: 
    llvm/lib/IR/Verifier.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 262f2aebefaf..2bbbfc0e5346 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -1969,8 +1969,8 @@ void Verifier::verifyParameterAttrs(AttributeSet Attrs, Type *Ty,
     uint64_t Val = Attrs.getAttribute(Attribute::NoFPClass).getValueAsInt();
     Check(Val != 0, "Attribute 'nofpclass' must have at least one test bit set",
           V);
-    Check((Val & ~fcAllFlags) == 0, "Invalid value for 'nofpclass' test mask",
-          V);
+    Check((Val & ~static_cast<unsigned>(fcAllFlags)) == 0,
+          "Invalid value for 'nofpclass' test mask", V);
   }
 }
 


        


More information about the llvm-commits mailing list