[clang] [compiler-rt] [clang][UBSan] Add implicit conversion check for bitfields (PR #75481)

Axel Lundberg via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 05:16:23 PST 2024


================
@@ -5570,11 +5570,44 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) {
       break;
     }
 
-    RValue RV = EmitAnyExpr(E->getRHS());
+    llvm::Value *Previous = nullptr;
+    RValue RV;
+    QualType SrcType = E->getRHS()->getType();
+    // If LHS refers to a bitfield we want to retrieve the value before
+    // implicit conversion between the bitfield type and the RHS type
+    // and evaluate RHS without integer sanitizer checks (if passed)
+    if (auto *ICE = RetrieveImplicitCastExprForBitfieldSanitizer(E)) {
----------------
Zonotora wrote:

Sounds good!

https://github.com/llvm/llvm-project/pull/75481


More information about the llvm-commits mailing list