[flang] Fix -Wsign-compare in check-call.cpp (NFC)
authorJie Fu <jiefu@tencent.com>
Tue, 4 Apr 2023 14:50:55 +0000 (22:50 +0800)
committerJie Fu <jiefu@tencent.com>
Tue, 4 Apr 2023 14:52:13 +0000 (22:52 +0800)
/data/llvm-project/flang/lib/Semantics/check-call.cpp:1234:29: error: comparison of integers of different signs: 'int' and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
  CHECK(index >= 0 && index < actuals.size());
                      ~~~~~ ^ ~~~~~~~~~~~~~~
/data/llvm-project/flang/include/flang/Common/idioms.h:89:20: note: expanded from macro 'CHECK'
                   ^
1 error generated.

flang/lib/Semantics/check-call.cpp

index 3a31dba..4d2a118 100644 (file)
@@ -1231,7 +1231,7 @@ bool CheckInterfaceForGeneric(const characteristics::Procedure &proc,
 bool CheckArgumentIsConstantExprInRange(
     const evaluate::ActualArguments &actuals, int index, int lowerBound,
     int upperBound, parser::ContextualMessages &messages) {
-  CHECK(index >= 0 && index < actuals.size());
+  CHECK(index >= 0 && static_cast<unsigned>(index) < actuals.size());
 
   const std::optional<evaluate::ActualArgument> &argOptional{actuals[index]};
   if (!argOptional) {