From c86988637c411a80556e26e07037dc6dcfade4d3 Mon Sep 17 00:00:00 2001 From: Cristian Cadar Date: Mon, 18 Mar 2013 13:15:46 +0000 Subject: Patch and test case by Jiri Slaby to handle "initializing globals when a global has an undef fill of holes inside structures." git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@177285 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Core/Executor.cpp | 2 +- test/Concrete/GlobalUndef.ll | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 test/Concrete/GlobalUndef.ll diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index 3f90c426..fa5835d3 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -361,7 +361,7 @@ void Executor::initializeGlobalObject(ExecutionState &state, ObjectState *os, initializeGlobalObject(state, os, cds->getElementAsConstant(i), offset + i*elementSize); #endif - } else { + } else if (!isa(c)) { unsigned StoreBits = targetData->getTypeStoreSizeInBits(c->getType()); ref C = evalConstant(c); diff --git a/test/Concrete/GlobalUndef.ll b/test/Concrete/GlobalUndef.ll new file mode 100644 index 00000000..c797ec81 --- /dev/null +++ b/test/Concrete/GlobalUndef.ll @@ -0,0 +1,15 @@ +; ModuleID = 'x.c' +target datalayout = +"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +%struct.anon = type { i8, [3 x i8] } + +@z = global %struct.anon { i8 1, [3 x i8] undef }, align 4 + +define i32 @main() nounwind { +entry: + %retval = alloca i32, align 4 + store i32 0, i32* %retval + ret i32 0 +} -- cgit 1.4.1