[all-commits] [llvm/llvm-project] b9d413: [clang][CFG] Fix assertion failure in checkIncorre...

Ziqing Luo via All-commits all-commits at lists.llvm.org
Mon Jun 9 20:54:23 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b9d41328c6c60c622fe5737f449e568f1ee4ec8f
      https://github.com/llvm/llvm-project/commit/b9d41328c6c60c622fe5737f449e568f1ee4ec8f
  Author: Ziqing Luo <ziqing at udel.edu>
  Date:   2025-06-10 (Tue, 10 Jun 2025)

  Changed paths:
    M clang/lib/Analysis/CFG.cpp
    A clang/test/Sema/warn-unreachable_crash.cpp

  Log Message:
  -----------
  [clang][CFG] Fix assertion failure in checkIncorrectLogicOperator (#142897)

`checkIncorrectLogicOperator` checks if an expression, for example `x !=
0 || x != 1.0`, is always true or false by comparing the two literals
`0` and `1.0`. But in case `x` is a 16-bit float, the two literals have
distinct types---16-bit float and double, respectively. Directly
comparing `APValue`s extracted from the two literals results in an
assertion failure because of their distinct types.

This commit fixes the issue by doing a conversion from the "smaller" one
to the "bigger" one. The two literals must be compatible because both of
them are comparing with `x`.

rdar://152456316



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list