[all-commits] [llvm/llvm-project] ab982e: [Sema] add warning for tautological FP compare wit...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Thu Mar 17 05:25:52 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ab982eace6e4951a2986567d29f4d6be002c1ba7
      https://github.com/llvm/llvm-project/commit/ab982eace6e4951a2986567d29f4d6be002c1ba7
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-03-17 (Thu, 17 Mar 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaChecking.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/test/Sema/floating-point-compare.c

  Log Message:
  -----------
  [Sema] add warning for tautological FP compare with literal

If we are equality comparing an FP literal with a value cast from a type
where the literal can't be represented, that's known true or false and
probably a programmer error.

Fixes issue #54222.
https://github.com/llvm/llvm-project/issues/54222

Note - I added the optimizer change with:
9397bdc67eb2
...and as discussed in the post-commit comments, that transform might be
too dangerous without this warning in place, so it was reverted to allow
this change first.

Differential Revision: https://reviews.llvm.org/D121306




More information about the All-commits mailing list