[flang-commits] [flang] ad8f22c - [flang] Rework line of code to dodge clang 16 warning

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Mon Oct 31 14:18:45 PDT 2022


Author: Peter Klausler
Date: 2022-10-31T14:18:32-07:00
New Revision: ad8f22c3fd4e92c69f6d0860ac5b3969f6a7aa9f

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

LOG: [flang] Rework line of code to dodge clang 16 warning

Recode a non-short-circuiting conjunction of two Boolean function calls
into separate statements to avoid a warning from clang 16.

Added: 
    

Modified: 
    flang/lib/Semantics/pointer-assignment.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/pointer-assignment.cpp b/flang/lib/Semantics/pointer-assignment.cpp
index 7661a36faaef4..9ac18b0d2c5b4 100644
--- a/flang/lib/Semantics/pointer-assignment.cpp
+++ b/flang/lib/Semantics/pointer-assignment.cpp
@@ -429,7 +429,9 @@ bool CheckPointerAssignment(evaluate::FoldingContext &context,
   }
   PointerAssignmentChecker checker{context, scope, *pointer};
   checker.set_isBoundsRemapping(isBoundsRemapping);
-  return checker.CheckLeftHandSide(lhs) & checker.Check(rhs);
+  bool lhsOk{checker.CheckLeftHandSide(lhs)};
+  bool rhsOk{checker.Check(rhs)};
+  return lhsOk && rhsOk; // don't short-circuit
 }
 
 bool CheckStructConstructorPointerComponent(evaluate::FoldingContext &context,


        


More information about the flang-commits mailing list