Testcase for r109556. Radar 8198362.
[oota-llvm.git] / test / FrontendC / 2010-05-14-Optimized-VarType.c
1 // RUN: %llvmgcc %s -Os -S -g -o - | grep DW_TAG_structure_type | count 1
2 // Variable 'a' is optimized but the debug info should preserve its type info.
3 #include <stdlib.h>
4
5 struct foo {
6         int Attribute;
7 };
8
9 void *getfoo(void) __attribute__((noinline));
10
11 void *getfoo(void)
12 {
13         int *x = malloc(sizeof(int));
14         *x = 42;
15         return (void *)x;
16 }
17
18 int main(int argc, char *argv[]) {
19         struct foo *a = (struct foo *)getfoo();
20
21         return a->Attribute;
22 }
23