OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [pubtypes-2.c] - Blame information for rev 826

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.