// circular references.
DMEntry = GV;
+ // Make sure to evaluate VLA bounds now so that we have them for later.
+ if (D.getType()->isVariablyModifiedType())
+ EmitVLASize(D.getType());
+
if (D.getInit()) {
llvm::Constant *Init = CGM.EmitConstantExpr(D.getInit(), D.getType(), this);
return llvm::Constant::getNullValue(ConvertType(E->getType()));
}
Value *VisitImplicitCastExpr(const ImplicitCastExpr *E);
- Value *VisitCastExpr(const CastExpr *E) {
+ Value *VisitCastExpr(const CastExpr *E) {
+ // Make sure to evaluate VLA bounds now so that we have them for later.
+ if (E->getType()->isVariablyModifiedType())
+ CGF.EmitVLASize(E->getType());
+
return EmitCastExpr(E->getSubExpr(), E->getType());
}
Value *EmitCastExpr(const Expr *E, QualType T);
-// RUN: clang-cc -emit-llvm < %s | grep puts
+// RUN: clang-cc -emit-llvm < %s | grep puts | count 4
+// PR3248
int a(int x)
{
int (*y)[x];
return sizeof(*(puts("asdf"),y));
}
+
+// PR3247
+int b() {
+ return sizeof(*(char(*)[puts("asdf")])0);
+}
+
+// PR3247
+int c() {
+ static int (*y)[puts("asdf")];
+ return sizeof(*y);
+}