[all-commits] [llvm/llvm-project] 5acd29: [clang][dataflow] Fix crash when RHS of `&&` or `|...

martinboehme via All-commits all-commits at lists.llvm.org
Thu Mar 23 01:03:02 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5acd29eb4d9e411b3631c26babcd1d2655623f4a
      https://github.com/llvm/llvm-project/commit/5acd29eb4d9e411b3631c26babcd1d2655623f4a
  Author: Martin Braenne <mboehme at google.com>
  Date:   2023-03-23 (Thu, 23 Mar 2023)

  Changed paths:
    M clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
    M clang/include/clang/Analysis/FlowSensitive/Transfer.h
    M clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
    M clang/lib/Analysis/FlowSensitive/Transfer.cpp
    M clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
    M clang/unittests/Analysis/FlowSensitive/TestingSupport.h
    M clang/unittests/Analysis/FlowSensitive/TransferTest.cpp

  Log Message:
  -----------
  [clang][dataflow] Fix crash when RHS of `&&` or `||` calls `noreturn` func.

The crash happened because the transfer fucntion for `&&` and `||`
unconditionally tried to retrieve the value of the RHS. However, if the RHS
is unreachable, there is no environment for it, and trying to retrieve the
operand's value causes an assertion failure.

See also the comments in the code for further details.

Reviewed By: xazax.hun, ymandel, sgatev, gribozavr2

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




More information about the All-commits mailing list