[PATCH] D37565: [Sema] -Wtautological-compare: handle comparison of unsigned with 0S.

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 7 05:48:32 PDT 2017


lebedev.ri created this revision.
lebedev.ri added a project: clang.

This is a first half(?) of a fix for the following bug:
https://bugs.llvm.org/show_bug.cgi?id=34147 (gcc -Wtype-limits)

GCC's -Wtype-limits does warn on comparison of unsigned value
with signed zero (as in, with 0), but clang only warns if the
zero is unsigned (i.e. 0U).

Also, be careful not to double-warn, or falsely warn on
comparison of signed/fp variable and signed 0.

Yes, all these testcases are needed.

Testing: $ ninja check-clang-sema check-clang-semacxx
Also, no new warnings for clang stage-2 build.


Repository:
  rL LLVM

https://reviews.llvm.org/D37565

Files:
  lib/Sema/SemaChecking.cpp
  test/Sema/outof-range-constant-compare.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37565.114164.patch
Type: text/x-patch
Size: 9943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170907/f35c913d/attachment.bin>


More information about the cfe-commits mailing list