[PATCH] D99181: [analyzer] Fix crash on spaceship operator (PR47511)

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 5 09:36:57 PDT 2021


NoQ added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp:169-171
+      } else if (B->getOpcode() == BinaryOperatorKind::BO_Cmp) {
+        // We can't reason about C++20 spaceship operator yet.
+        return;
----------------
steakhal wrote:
> What a madness, we deal with every binary operator kind here O.O
> 
> Why do we get Undefined here? If we don't model something - theoretically - we should get Unknown.
> I'm confused.
Yes we should get `Unknown`. We should only return `Undefined` when there's undefined behavior in the program. Sounds like returning `nullptr` from `BasicValueFactory` causes `SValBuilder` to produce `Undefined` instead. I believe this needs to be fixed in `SValBuilder` instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99181/new/

https://reviews.llvm.org/D99181



More information about the cfe-commits mailing list