summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-05-14 21:04:45 +0000
committerDevang Patel <dpatel@apple.com>2010-05-14 21:04:45 +0000
commitc87e867111919591e0e7de34872eae5f13ff0459 (patch)
treedb42c4e760b3ca810ebd25ee8a62715cf87f4dc0
parent35dd005d22ca1f21615431647b423d3f152ad5de (diff)
downloadbcm5719-llvm-c87e867111919591e0e7de34872eae5f13ff0459.tar.gz
bcm5719-llvm-c87e867111919591e0e7de34872eae5f13ff0459.zip
Test case for r103800.
llvm-svn: 103801
-rw-r--r--llvm/test/FrontendC/2010-05-14-Optimized-VarType.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/test/FrontendC/2010-05-14-Optimized-VarType.c b/llvm/test/FrontendC/2010-05-14-Optimized-VarType.c
new file mode 100644
index 00000000000..2aa85b5846e
--- /dev/null
+++ b/llvm/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 <stdlib.h>
+
+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;
+}
+
OpenPOWER on IntegriCloud