From a6b2f63dbf0dd4498409d3caaf34eaccea3019ea Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Fri, 24 Oct 2014 10:48:43 +0200 Subject: Executor: do not crash on non-sized globals Sometimes, globals are not sized and ->getTypeStoreSize on such type crashes inside the LLVM. Check whether type is sized prior to calling the function above. A minimalistic example of Y being unsized with no effect on the actual code is put to tests. [v2] Use klee_warning for printing. And use %.*s formatting string given StringRef.data() need not be null terminated. Signed-off-by: Jiri Slaby --- test/Feature/NonSizedGlobals.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/Feature/NonSizedGlobals.c (limited to 'test/Feature') diff --git a/test/Feature/NonSizedGlobals.c b/test/Feature/NonSizedGlobals.c new file mode 100644 index 00000000..b98f7bf1 --- /dev/null +++ b/test/Feature/NonSizedGlobals.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc +// RUN: rm -rf %t.klee-out +// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc + +struct X; +extern struct X Y; +void *ptr = &Y; + +int main() +{ + return 0; +} -- cgit 1.4.1