From eb197d5737fa8fe9e75747ee1a26ee55b942c916 Mon Sep 17 00:00:00 2001 From: Julian Büning Date: Tue, 15 Oct 2019 17:13:46 +0200 Subject: fix Executor: remove UB from bindInstructionConstants --- lib/Core/Executor.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index 2e6f9c89..ea386cfd 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -3315,14 +3315,15 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { } void Executor::bindInstructionConstants(KInstruction *KI) { - KGEPInstruction *kgepi = static_cast(KI); - if (GetElementPtrInst *gepi = dyn_cast(KI->inst)) { + KGEPInstruction *kgepi = static_cast(KI); computeOffsets(kgepi, gep_type_begin(gepi), gep_type_end(gepi)); } else if (InsertValueInst *ivi = dyn_cast(KI->inst)) { + KGEPInstruction *kgepi = static_cast(KI); computeOffsets(kgepi, iv_type_begin(ivi), iv_type_end(ivi)); assert(kgepi->indices.empty() && "InsertValue constant offset expected"); } else if (ExtractValueInst *evi = dyn_cast(KI->inst)) { + KGEPInstruction *kgepi = static_cast(KI); computeOffsets(kgepi, ev_type_begin(evi), ev_type_end(evi)); assert(kgepi->indices.empty() && "ExtractValue constant offset expected"); } -- cgit 1.4.1