[all-commits] [llvm/llvm-project] a01383: [Clang] Diagnose undefined behavior in a constant ...

Shafik Yaghmour via All-commits all-commits at lists.llvm.org
Thu Jan 12 08:04:23 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a0138390dd2ac2130c9f76e6778d6e45e4dc5526
      https://github.com/llvm/llvm-project/commit/a0138390dd2ac2130c9f76e6778d6e45e4dc5526
  Author: Shafik Yaghmour <shafik.yaghmour at intel.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/AST/ExprConstant.cpp
    M clang/test/CXX/expr/expr.const/p2-0x.cpp

  Log Message:
  -----------
  [Clang] Diagnose undefined behavior in a constant expression while evaluating a compound assignment with remainder as operand

Currently we don't diagnose overflow in a constant expression for the case of
compound assignment with remainder as a operand.

In handleIntIntBinOp the arguments LHS and Result can be the same source but in
the check for remainder in this function we assigned to Result before checking
for overflow. In all the other operations the check is done before Result is
assigned to.

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




More information about the All-commits mailing list