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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [gcc.dg/] [struct/] [wo_prof_malloc_size_var.c] - Blame information for rev 338

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
typedef struct
6
{
7
  int a;
8
  float b;
9
}str_t;
10
 
11
#ifdef STACK_SIZE
12
#if STACK_SIZE > 8000
13
#define N 1000
14
#else
15
#define N (STACK_SIZE/8)
16
#endif
17
#else
18
#define N 1000
19
#endif
20
 
21
int
22
main ()
23
{
24
  int i, num;
25
 
26
  num = rand();
27
  num = num > N ? N : num;
28
  str_t * p = malloc (num * sizeof (str_t));
29
 
30
  if (p == 0)
31
    return 0;
32
 
33
  for (i = 0; i < num; i++)
34
    p[i].b = i;
35
 
36
  for (i = 0; i < num; i++)
37
    p[i].a = p[i].b + 1;
38
 
39
  for (i = 0; i < num; i++)
40
    if (p[i].a != p[i].b + 1)
41
      abort ();
42
 
43
  return 0;
44
}
45
 
46
/*--------------------------------------------------------------------------*/
47
/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
48
/* { 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.