about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--lib/Core/Executor.cpp2
-rw-r--r--test/Concrete/GlobalUndef.ll15
2 files changed, 16 insertions, 1 deletions
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<UndefValue>(c)) {
     unsigned StoreBits = targetData->getTypeStoreSizeInBits(c->getType());
     ref<ConstantExpr> 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
+}