Report an error for bad inline assembly, where the value passed for an
authorBob Wilson <bob.wilson@apple.com>
Tue, 22 Dec 2009 18:34:19 +0000 (18:34 +0000)
committerBob Wilson <bob.wilson@apple.com>
Tue, 22 Dec 2009 18:34:19 +0000 (18:34 +0000)
"indirect" operand is not a pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91913 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

index f1b2c1dcc4509ed93e38bcbb706b6aea293beb38..68a2e7b7c2749f31b76c19df87ad8540ea75f621 100644 (file)
@@ -5482,8 +5482,12 @@ public:
 
     // If this is an indirect operand, the operand is a pointer to the
     // accessed type.
-    if (isIndirect)
-      OpTy = cast<PointerType>(OpTy)->getElementType();
+    if (isIndirect) {
+      const llvm::PointerType *PtrTy = dyn_cast<PointerType>(OpTy);
+      if (!PtrTy)
+        llvm_report_error("Indirect operand for inline asm not a pointer!");
+      OpTy = PtrTy->getElementType();
+    }
 
     // If OpTy is not a single value, it may be a struct/union that we
     // can tile with integers.