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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [struct/] [w_prof_two_strs.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
#include <stdlib.h>
2
 
3
typedef struct
4
{
5
  int a;
6
  float b;
7
}str_t1;
8
 
9
typedef struct
10
{
11
  int c;
12
  float d;
13
}str_t2;
14
 
15
#ifdef STACK_SIZE
16
#if STACK_SIZE > 16000
17
#define N 1000
18
#else
19
#define N (STACK_SIZE/16)
20
#endif
21
#else
22
#define N 1000
23
#endif
24
 
25
str_t1 *p1;
26
str_t2 *p2;
27
int num;
28
 
29
void
30
foo (void)
31
{
32
  int i;
33
 
34
  for (i=0; i < num; i++)
35
    p2[i].c = 2;
36
}
37
 
38
int
39
main ()
40
{
41
  int i, r;
42
 
43
  r = rand ();
44
  num = r > N ? N : r;
45
  p1 = malloc (num * sizeof (str_t1));
46
  p2 = malloc (num * sizeof (str_t2));
47
 
48
  if (p1 == NULL || p2 == NULL)
49
    return 0;
50
 
51
  for (i = 0; i < num; i++)
52
    p1[i].a = 1;
53
 
54
  foo ();
55
 
56
  for (i = 0; i < num; i++)
57
    if (p1[i].a != 1 || p2[i].c != 2)
58
      abort ();
59
 
60
  return 0;
61
}
62
 
63
/*--------------------------------------------------------------------------*/
64
/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" } } */
65
/* { dg-final-use { cleanup-ipa-dump "*" } } */
66
 

powered by: WebSVN 2.1.0

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