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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* PR c/21536 */
2
/* { dg-do run } */
3
/* { dg-options "-O2 -Wuninitialized" } */
4
 
5
typedef __SIZE_TYPE__ size_t;
6
extern void *malloc (size_t);
7
extern void free (void *);
8
 
9
void *
10
foo (int x, int y)
11
{
12
  void *d = malloc (x * y * sizeof (double));
13
  double (*e)[x][y] = d;
14
  x += 10;
15
  y += 10;
16
  if (x > 18)
17
    (*e)[x - 12][y - 12] = 0.0;
18
  else
19
    (*e)[x - 11][y - 11] = 1.0;
20
  return d;
21
}
22
 
23
void *
24
bar (int x, int y)
25
{
26
  void *d = malloc (x * y * sizeof (double));
27
  struct S
28
    {
29
      double (*e)[x][y];
30
      double (*f)[x][y];
31
    } s;
32
  s.e = d;
33
  s.f = d;
34
  x += 10;
35
  y += 10;
36
  if (x > 18)
37
    (*s.e)[x - 12][y - 12] = 0.0;
38
  else
39
    (*s.e)[x - 11][y - 11] = 1.0;
40
  if (x > 16)
41
    (*s.f)[x - 13][y - 13] = 0.0;
42
  else
43
    (*s.f)[x - 14][y - 14] = 1.0;
44
  return d;
45
}
46
 
47
int
48
main ()
49
{
50
  void *d1 = foo (10, 10);
51
  void *d2 = bar (10, 10);
52
  free (d1);
53
  free (d2);
54
  return 0;
55
}

powered by: WebSVN 2.1.0

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