• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
getfoo(void)11 void *getfoo(void)
12 {
13 	int *x = malloc(sizeof(int));
14 	*x = 42;
15 	return (void *)x;
16 }
17 
main(int argc,char * argv[])18 int main(int argc, char *argv[]) {
19 	struct foo *a = (struct foo *)getfoo();
20 
21 	return a->Attribute;
22 }
23 
24