[flang] Rework line of code to dodge clang 16 warning
authorPeter Klausler <pklausler@nvidia.com>
Mon, 31 Oct 2022 21:17:02 +0000 (14:17 -0700)
committerPeter Klausler <pklausler@nvidia.com>
Mon, 31 Oct 2022 21:18:32 +0000 (14:18 -0700)
Recode a non-short-circuiting conjunction of two Boolean function calls
into separate statements to avoid a warning from clang 16.

flang/lib/Semantics/pointer-assignment.cpp

index 7661a36..9ac18b0 100644 (file)
@@ -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,