[PATCH] D155457: [clang] Skip tautological comparison if the comparison involves the 'size_t' type
Shivam Gupta via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 18 10:10:32 PDT 2023
xgupta added a comment.
In D155457#4511392 <https://reviews.llvm.org/D155457#4511392>, @aaron.ballman wrote:
> Whether `size_t` comes from the system header or whether it's manually deduced from `decltype(sizeof(0))` should make no difference as far as the frontend is concerned; they should resolve to the same type. Can you explain the test failure you're seeing in a bit more detail?
: 'RUN: at line 1'; /home/shivam/.llvm/llvm-project/build/bin/clang -cc1 -internal-isystem /home/shivam/.llvm/llvm-project/build/lib/clang/17/include -nostdsysteminc /home/shivam/.llvm/llvm-project/clang/test/Sema/type-limit-compare.cpp -fsyntax-only -Wtautological-type-limit-compare -verify
--
Exit Code: 1
Command Output (stderr):
--
error: 'warning' diagnostics seen but not expected:
File /home/shivam/.llvm/llvm-project/clang/test/Sema/type-limit-compare.cpp Line 12: result of comparison 'uint64_t' (aka 'unsigned long long') > 18446744073709551615 is always false
1 error generated.
I think the issue is with __SIZE_MAX__ vs std::numeric_limits<std::size_t>::max() but not sure.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155457/new/
https://reviews.llvm.org/D155457
More information about the cfe-commits
mailing list