2018-04-09 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pubtypes-1.c
blob4d675b8e400352a1c390464bffe9704d32bafb70
1 /* { dg-do compile { target *-*-darwin* } } */
2 /* { dg-options "-O0 -gdwarf-2 -dA -fno-eliminate-unused-debug-types" } */
3 /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } } */
4 /* { dg-final { scan-assembler "__debug_pubtypes" } } */
5 /* { dg-final { scan-assembler "long+\[ \t\]+0x\[0-9a-f]+\[ \t\]+\[#;]+\[ \t\]+Pub Info Length" } } */
6 /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */
7 /* { dg-final { scan-assembler "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */
10 #include <stdlib.h>
11 #include <stdio.h>
13 struct used_struct
15 int key;
16 char *name;
19 struct unused_struct
21 int key1;
22 int f2;
23 double f3;
24 char *f4;
25 struct unused_struct *next;
28 int
29 main (int argc, char **argv)
31 int i;
32 struct used_struct *my_list;
34 my_list = (struct used_struct *) malloc (10 * sizeof (struct used_struct));
36 for (i = 0; i < 10; i++)
38 my_list[i].key = i;
39 my_list[i].name = (char *) malloc (11);
40 sprintf (my_list[i].name, "Alice_%d", i);
43 for (i = 0; i < 10; i++)
44 fprintf (stdout, "Key: %d, Name: %s\n", my_list[i].key, my_list[i].name);
46 return 0;