IVOPT performance tuning patch. The main problem is a variant of maximal weight
[official-gcc.git] / gcc / testsuite / gcc.dg / pubtypes-4.c
blobdb222da4a7e54904b9437735f18d294bfa8440c1
1 /* { dg-do compile { target *-*-darwin* } } */
2 /* { dg-options "-O0 -gdwarf-2 -dA" } */
3 /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } { "*" } { "" } } */
4 /* { dg-final { scan-assembler "__debug_pubtypes" } } */
5 /* { dg-final { scan-assembler "long+\[ \t\]+0xa1+\[ \t\]+\[#;]+\[ \t\]+Length of Public Type Names Info" } } */
6 /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */
7 /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */
8 /* { dg-final { scan-assembler "\"list_name_type\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */
9 /* { dg-final { scan-assembler "\"enum_list_array\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */
10 /* { dg-final { scan-assembler "\"field_union\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */
12 #include <stdlib.h>
13 #include <stdio.h>
15 struct used_struct
17 int key;
18 char *name;
19 union field_union
21 char u_c;
22 int u_i;
23 long u_l;
24 double u_d;
25 } u;
28 struct unused_struct
30 int key1;
31 int f2;
32 double f3;
33 char *f4;
34 struct unused_struct *next;
37 enum list_name_type {
38 boy_name,
39 girl_name,
40 unknown
44 typedef enum list_name_type *enum_list_array;
46 enum_list_array enum_list;
48 void
49 foo (struct used_struct *list)
51 int b_count = 0;
52 int g_count = 0;
53 int i;
55 enum_list = (enum_list_array) malloc (10 * sizeof (enum list_name_type));
57 for (i = 0; i < 10; i++)
59 if (strncmp (list[i].name, "Alice", 5) == 0)
61 enum_list[i] = girl_name;
62 g_count++;
64 else if (strncmp (list[i].name, "David", 5) == 0)
66 enum_list[i] = boy_name;
67 b_count++;
69 else
70 enum_list[i] = unknown;
75 int
76 main (int argc, char **argv)
78 int i;
79 struct used_struct *my_list;
81 my_list = (struct used_struct *) malloc (10 * sizeof (struct used_struct));
83 for (i = 0; i < 10; i++)
85 my_list[i].key = i;
86 my_list[i].name = (char *) malloc (11);
87 sprintf (my_list[i].name, "Alice_%d", i);
90 foo (my_list);
92 for (i = 0; i < 10; i++)
93 fprintf (stdout, "Key: %d, Name: %s\n", my_list[i].key, my_list[i].name);
95 return 0;