[flang-commits] [flang] a8f1185 - [flang] Fix -Wsign-compare in check-call.cpp (NFC)

Jie Fu via flang-commits flang-commits at lists.llvm.org
Tue Apr 4 07:52:44 PDT 2023


Author: Jie Fu
Date: 2023-04-04T22:52:13+08:00
New Revision: a8f1185a7fdee4183a544370dfbb485b31d4077a

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

LOG: [flang] Fix -Wsign-compare in check-call.cpp (NFC)

/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.

Added: 
    

Modified: 
    flang/lib/Semantics/check-call.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/check-call.cpp b/flang/lib/Semantics/check-call.cpp
index 3a31dba64eef..4d2a118596e1 100644
--- a/flang/lib/Semantics/check-call.cpp
+++ b/flang/lib/Semantics/check-call.cpp
@@ -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) {


        


More information about the flang-commits mailing list