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/] [wo_prof_two_strs.c] - Blame information for rev 298

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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