1. Jan 27, 2023
    • Paul Robinson's avatar
      [unittests] Use GTEST_SKIP() instead of return when appropriate · 787876b0
      Paul Robinson authored
      Basically NFC: A TEST/TEST_F/etc that bails out early (usually because
      setup failed or some other runtime condition wasn't met) generally
      should use GTEST_SKIP() to report its status correctly, unless it
      takes steps to report another status (e.g., FAIL()).
      787876b0
    • Tomasz Kamiński's avatar
      [analyzer] Fix assertion failure in SMT conversion for unary operator on floats · 3674421c
      Tomasz Kamiński authored
      In the handling of the Symbols from the RangExpr, the code assumed that
      the operands of the unary operators need to have integral type.
      However, the CSA can create SymExpr with a floating point operand, when
      the integer value is cast into it, like `(float)h == (float)l` where
      both of `h` and `l` are integers.
      
      This patch handles such situations, by using `fromFloatUnOp()` instead
      of `fromUnOp()`, when the operand have a floating point type.
      
      I have investigated all other calls of `fromUnOp()`, and for one in:
      
       - `getZeroExpr()` is applied only on boolean types, so it correct
       - `fromBinOp()` is not invoked for floating points
       - `fromFloatUnOp()` I am uncertain about this case and I was not able
         to produce a test that would reach this point, as a negation of
         floating points numbers seem to produce `Unknown` symbols.
      
      This issue exists since the introduction of `UnarySymExpr` in D125318
      and their handling for Z3 in D125547.
      
      Patch by Tomasz Kamiński.
      
      Reviewed By: mikhail.ramalho
      
      Differential Revision: https://reviews.llvm.org/D140891
      3674421c
    • Arseniy Zaostrovnykh's avatar
      Fix assertion failure "PathDiagnosticSpotPiece's must have a valid location."... · 98d55095
      Arseniy Zaostrovnykh authored
      Fix assertion failure "PathDiagnosticSpotPiece's must have a valid location." in ReturnPtrRange checker on builtin functions
      
      Builtin functions (such as `std::move`, `std::forward`, `std::as_const`)
      have a body generated during the analysis not related to any source file
      so their statements have no valid source locations.
      `ReturnPtrRange` checker should not report issues for these builtin
      functions because they only forward its parameter and do not create any
      new pointers.
      
      Fixes #55347
      
      Patch by Arseniy Zaostrovnykh.
      
      Reviewed By: NoQ
      
      Differential Revision: https://reviews.llvm.org/D138713
      98d55095
  2. Jan 26, 2023