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

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 24 03:11:07 PDT 2021


steakhal added a comment.

I'm always in favor of bugfixes. However, I have some concerns about this one.



================
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;
----------------
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.


================
Comment at: clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp:331
 
       // Note: LAnd, LOr, Comma are handled specially by higher-level logic.
 
----------------
So, there are some corner cases already.
I can't see any way of implementing this reasonably here, as you pointed out the return value of the function is not a good fit.

Shouldn't put your mock 'implementation' to a different place?
I'm just nitpicking though.


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