This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt][scudo] Fix sign-compare warnings
ClosedPublic

Authored by jsji on May 24 2021, 8:07 AM.

Details

Summary

Fix buildbot failure
https://lab.llvm.org/buildbot/#/builders/57/builds/6542/steps/6/logs/stdio

/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:1629:28:
error: comparison of integers of different signs: 'const unsigned long'
and 'const int' [-Werror,-Wsign-compare]
GTEST_IMPL_CMP_HELPER_(GT, >);
~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:1609:12:
note: expanded from macro 'GTEST_IMPL_CMP_HELPER_'

if (val1 op val2) {\
    ~~~~ ^  ~~~~

/llvm-project/compiler-rt/lib/scudo/standalone/tests/common_test.cpp:30:3:
note: in instantiation of function template specialization
'testing::internal::CmpHelperGT<unsigned long, int>' requested here

EXPECT_GT(OnStart, 0);
^

Diff Detail

Event Timeline

jsji created this revision.May 24 2021, 8:07 AM
jsji requested review of this revision.May 24 2021, 8:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2021, 8:07 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.May 24 2021, 1:31 PM
This revision is now accepted and ready to land.May 24 2021, 1:31 PM
vitalybuka requested changes to this revision.May 24 2021, 1:31 PM
This revision now requires changes to proceed.May 24 2021, 1:31 PM
vitalybuka accepted this revision.May 24 2021, 1:32 PM

Thanks

compiler-rt/lib/scudo/standalone/tests/common_test.cpp
42

could you change to reinterpret cast?
or maybe N to size_t?

This revision is now accepted and ready to land.May 24 2021, 1:32 PM
jsji added inline comments.May 24 2021, 2:00 PM
compiler-rt/lib/scudo/standalone/tests/common_test.cpp
42

Do you mean ptrdiff_t? size_t is also unsigned, while std::count is returning signed int.

jsji updated this revision to Diff 347495.May 24 2021, 2:07 PM

Update type of N to size_t.

This revision was landed with ongoing or failed builds.May 24 2021, 2:42 PM
This revision was automatically updated to reflect the committed changes.