Skip to content

Conversation

@jsji
Copy link
Member

@jsji jsji commented Mar 25, 2025

Fix error

llvm\clang\tools\amdgpu-arch\AMDGPUArchByHIP.cpp(102,29): error: result of comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
102 | StringRef VerStr = (Pos == StringRef::npos) ? S : S.substr(Pos + 1);

Fix error

llvm\clang\tools\amdgpu-arch\AMDGPUArchByHIP.cpp(102,29): error: result of comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
102 |     StringRef VerStr = (Pos == StringRef::npos) ? S : S.substr(Pos + 1);
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:AMDGPU labels Mar 25, 2025
@jsji jsji requested a review from yxsamliu March 25, 2025 02:57
@jsji jsji self-assigned this Mar 25, 2025
@jsji jsji requested a review from jhuber6 March 25, 2025 02:57
@llvmbot
Copy link
Member

llvmbot commented Mar 25, 2025

@llvm/pr-subscribers-backend-amdgpu

@llvm/pr-subscribers-clang

Author: Jinsong Ji (jsji)

Changes

Fix error

llvm\clang\tools\amdgpu-arch\AMDGPUArchByHIP.cpp(102,29): error: result of comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
102 | StringRef VerStr = (Pos == StringRef::npos) ? S : S.substr(Pos + 1);


Full diff: https://github.com/llvm/llvm-project/pull/132868.diff

1 Files Affected:

  • (modified) clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp (+1-1)
diff --git a/clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp b/clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp
index 4803f83f55ac7..02431bf909d6d 100644
--- a/clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp
+++ b/clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp
@@ -98,7 +98,7 @@ static std::vector<std::string> getSearchPaths() {
 // Custom comparison function for dll name
 static bool compareVersions(StringRef A, StringRef B) {
   auto ParseVersion = [](StringRef S) -> VersionTuple {
-    unsigned Pos = S.find_last_of('_');
+    size_t Pos = S.find_last_of('_');
     StringRef VerStr = (Pos == StringRef::npos) ? S : S.substr(Pos + 1);
     VersionTuple Vt;
     (void)Vt.tryParse(VerStr);

@jsji jsji merged commit f7f5aa2 into llvm:main Mar 25, 2025
14 checks passed
Copy link
Collaborator

@yxsamliu yxsamliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:AMDGPU clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants