[llvm-commits] [llvm] r103801 - /llvm/trunk/test/FrontendC/2010-05-14-Optimized-VarType.c

Devang Patel dpatel at apple.com
Fri May 14 14:04:45 PDT 2010


Author: dpatel
Date: Fri May 14 16:04:45 2010
New Revision: 103801

URL: http://llvm.org/viewvc/llvm-project?rev=103801&view=rev
Log:
Test case for r103800.

Added:
    llvm/trunk/test/FrontendC/2010-05-14-Optimized-VarType.c

Added: llvm/trunk/test/FrontendC/2010-05-14-Optimized-VarType.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2010-05-14-Optimized-VarType.c?rev=103801&view=auto
==============================================================================
--- llvm/trunk/test/FrontendC/2010-05-14-Optimized-VarType.c (added)
+++ llvm/trunk/test/FrontendC/2010-05-14-Optimized-VarType.c Fri May 14 16:04:45 2010
@@ -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;
+}
+





More information about the llvm-commits mailing list