From 6c33db34da909d004f9b4f3b120e97b713c82c13 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Mon, 6 Feb 2017 14:40:12 +0300 Subject: [PATCH] Assert type used in virtual dispatch. --- .../src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index 865a49f17a6..662d3ef08c8 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -1884,6 +1884,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid fun callVirtual(descriptor: FunctionDescriptor, args: List, resultLifetime: Lifetime): LLVMValueRef { + assert(LLVMTypeOf(args[0]) == codegen.kObjHeaderPtr) val typeInfoPtrPtr = LLVMBuildStructGEP(codegen.builder, args[0], 0 /* type_info */, "")!! val typeInfoPtr = codegen.load(typeInfoPtrPtr) assert (typeInfoPtr.type == codegen.kTypeInfoPtr)