| 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" } } */ |
| 8 |
|
| 9 |
|
| 10 |
#include <stdlib.h> |
| 11 |
#include <stdio.h> |
| 12 |
|
| 13 |
struct used_struct |
| 14 |
{ |
| 15 |
int key; |
| 16 |
char *name; |
| 17 |
}; |
| 18 |
|
| 19 |
struct unused_struct |
| 20 |
{ |
| 21 |
int key1; |
| 22 |
int f2; |
| 23 |
double f3; |
| 24 |
char *f4; |
| 25 |
struct unused_struct *next; |
| 26 |
}; |
| 27 |
|
| 28 |
int |
| 29 |
main (int argc, char **argv) |
| 30 |
{ |
| 31 |
int i; |
| 32 |
struct used_struct *my_list; |
| 33 |
|
| 34 |
my_list = (struct used_struct *) malloc (10 * sizeof (struct used_struct)); |
| 35 |
|
| 36 |
for (i = 0; i < 10; i++) |
| 37 |
{ |
| 38 |
my_list[i].key = i; |
| 39 |
my_list[i].name = (char *) malloc (11); |
| 40 |
sprintf (my_list[i].name, "Alice_%d", i); |
| 41 |
} |
| 42 |
|
| 43 |
for (i = 0; i < 10; i++) |
| 44 |
fprintf (stdout, "Key: %d, Name: %s\n", my_list[i].key, my_list[i].name); |
| 45 |
|
| 46 |
return 0; |
| 47 |
} |