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\]+0x13b+\[ \t\]+\[#;]+\[ \t\]+Pub Info Length" } } */
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-not "\"list_name_type\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */
9
10#include <stdlib.h>
11#include <stdio.h>
12#include <string.h>
13
14struct used_struct
15{
16  int key;
17  char *name;
18};
19
20struct unused_struct
21{
22  int key1;
23  int f2;
24  double f3;
25  char *f4;
26  struct unused_struct *next;
27};
28
29void
30foo (struct used_struct *list)
31{
32  enum list_name_type {
33    boy_name,
34    girl_name,
35    unknown
36  };
37
38  int b_count = 0;
39  int g_count = 0;
40  int i;
41  enum list_name_type *enum_list;
42
43  enum_list = (enum list_name_type *) malloc (10 * sizeof (enum list_name_type));
44
45  for (i = 0; i < 10; i++)
46    {
47      if (strncmp (list[i].name, "Alice", 5) == 0)
48	{
49	  enum_list[i] = girl_name;
50	  g_count++;
51	}
52      else if (strncmp (list[i].name, "David", 5) == 0)
53	{
54	  enum_list[i] = boy_name;
55	  b_count++;
56	}
57      else
58	enum_list[i] = unknown;
59    }
60
61}
62
63int
64main (int argc, char **argv)
65{
66  int i;
67  struct used_struct *my_list;
68
69  my_list = (struct used_struct *) malloc (10 * sizeof (struct used_struct));
70
71  for (i = 0; i < 10; i++)
72    {
73      my_list[i].key = i;
74      my_list[i].name = (char *) malloc (11);
75      sprintf (my_list[i].name, "Alice_%d", i);
76    }
77
78  foo (my_list);
79
80  for (i = 0; i < 10; i++)
81    fprintf (stdout, "Key: %d, Name: %s\n", my_list[i].key, my_list[i].name);
82
83  return 0;
84}
85