[PATCH] Add warnings for undefined behaviors with pointers

Richard Trieu rtrieu at google.com
Mon Jun 2 21:25:28 PDT 2014


Extend tautological compare and bool conversion warnings to undefined pointer operations.  These are cases where all defined behavior will give the expression one value, while the other value can only result from undefined behavior, which the optimizer can remove.  These cases are addresses of references and the this pointer.  This warning was requested in PR19899 in response to commit r209723.

http://reviews.llvm.org/D3999

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaChecking.cpp
  test/SemaCXX/warn-tautological-undefined-compare.cpp
  test/SemaCXX/warn-undefined-bool-conversion.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3999.10040.patch
Type: text/x-patch
Size: 7734 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140603/835d4e7c/attachment.bin>


More information about the cfe-commits mailing list