diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index ce92c9cb697..70aee05f1ce 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -2120,6 +2120,9 @@ MemoryInst : MALLOC Types { if (!isa($3->get())) ThrowException("Can't load from nonpointer type: " + (*$3)->getDescription()); + if (!cast($3->get())->getElementType()->isFirstClassType()) + ThrowException("Can't load from pointer of non-first-class type: " + + (*$3)->getDescription()); $$ = new LoadInst(getVal(*$3, $4), "", $1); delete $3; }