[PATCH] D47628: Detect an incompatible VLA pointer assignment

Jeremy Morse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 4 02:17:50 PDT 2018


jmorse marked 2 inline comments as done.
jmorse added inline comments.


================
Comment at: lib/AST/ASTContext.cpp:8588
+          Expr *E = VAT->getSizeExpr();
+          if (E && VAT->getSizeExpr()->isIntegerConstantExpr(TheInt, *this))
+            return std::make_pair(true, TheInt);
----------------
efriedma wrote:
> `E && E->isIntegerConstantExpr`?
Done


================
Comment at: lib/AST/ASTContext.cpp:8603
+      std::tie(HaveRSize, RSize) = SizeFetch(RVAT, RCAT);
+      if (HaveLSize && HaveRSize && LSize != RSize)
+        return {}; // Definite, but unequal, array dimension
----------------
efriedma wrote:
> The != will hit an assertion failure if LSize and RSize don't have the same bitwidth.
Erk -- replaced with APInt::isSameValue.


https://reviews.llvm.org/D47628





More information about the cfe-commits mailing list