aboutsummaryrefslogtreecommitdiffstats
path: root/test/FrontendC/2010-05-14-Optimized-VarType.c
blob: 2aa85b5846eaf6aa5a78f5930544361ce75d411b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;
}