From 6bbba26bf1f18e14ba55f99825871f5b76e2d5b4 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Fri, 14 May 2010 21:04:45 +0000 Subject: [PATCH] Test case for r103800. llvm-svn: 103801 --- test/FrontendC/2010-05-14-Optimized-VarType.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/FrontendC/2010-05-14-Optimized-VarType.c diff --git a/test/FrontendC/2010-05-14-Optimized-VarType.c b/test/FrontendC/2010-05-14-Optimized-VarType.c new file mode 100644 index 00000000000..2aa85b5846e --- /dev/null +++ b/test/FrontendC/2010-05-14-Optimized-VarType.c @@ -0,0 +1,23 @@ +// RUN: %llvmgcc %s -Os -S -g -o - | grep DW_TAG_structure_type | count 1 +// Variable 'a' is optimized but the debug info should preserve its type info. +#include + +struct foo { + int Attribute; +}; + +void *getfoo(void) __attribute__((noinline)); + +void *getfoo(void) +{ + int *x = malloc(sizeof(int)); + *x = 42; + return (void *)x; +} + +int main(int argc, char *argv[]) { + struct foo *a = (struct foo *)getfoo(); + + return a->Attribute; +} +