[PATCH] D126779: [analyzer] Fix assertion in simplifySymbolCast

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 18 11:18:41 PDT 2022


steakhal accepted this revision.
steakhal added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:1082
+  // FIXME support cast from non-integers.
+  // E.g (char)(double)(double x) -> (char)(double x)
+  if (!RT->isIntegralOrEnumerationType())
----------------
martong wrote:
> steakhal wrote:
> > Well, I would expect the same, but crosscheck this with the actual dump.
> Please elaborate.
nvm


================
Comment at: clang/test/Analysis/produce-symbolcast_x86.cpp:16
+  double D = n / 30;
+  clang_analyzer_dump(D); // expected-warning{{(double) ((double) ((reg_$0<int n>) / 30))}}
+  char C = D;
----------------
martong wrote:
> steakhal wrote:
> > Place here a FIXME that we should not have two double casts.
> The `(double)(double)` problem is handled in the parent patch. Please check that out.
Yeey, awesome!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126779



More information about the cfe-commits mailing list