[PATCH] D47628: Detect an incompatible VLA pointer assignment

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 1 08:38:39 PDT 2018


efriedma 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);
----------------
`E && E->isIntegerConstantExpr`?


================
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
----------------
The != will hit an assertion failure if LSize and RSize don't have the same bitwidth.


Repository:
  rC Clang

https://reviews.llvm.org/D47628





More information about the cfe-commits mailing list