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/] [tree-ssa/] [20040326-2.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-options "-O2 -fno-inline-functions" } */
2
/* { dg-do run } */
3
 
4
/* Gimplification problem exposed by zsh.  All the side-effects in
5
   function arguments and in the called expression should happen
6
   before the actual function call.  */
7
extern void abort (void);
8
int A;
9
 
10
typedef void (*fnptr) (void);
11
fnptr *F;
12
 
13
void
14
foo (int x)
15
{
16
  if (A == x)
17
    abort ();
18
}
19
 
20
void
21
bar (int x, int y)
22
{
23
  if (x == 5 || y != 3)
24
    abort ();
25
}
26
 
27
void
28
boz (void)
29
{
30
  abort ();
31
}
32
 
33
void
34
baz (void)
35
{
36
  if (*F != boz)
37
    abort ();
38
}
39
 
40
fnptr B[2] = { baz, boz };
41
 
42
main ()
43
{
44
  int b, c;
45
 
46
  /* The gimplifier was emitting A++ after the call to foo.  */
47
  A = 5;
48
  foo (A++);
49
 
50
  /* The increment to 'b' and 'c' must happen before the call.  However,
51
     the first argument to bar() must be the original value of 'b', while
52
     the second argument must be the new value of 'c'.  */
53
  b = 4;
54
  c = 2;
55
  bar (b++, ++c);
56
 
57
  /* This call via function pointer *F should go to baz, but F should
58
     be incremented before the actual call (i.e., right before the
59
     call F should be pointing to boz).  */
60
  F = &B[0];
61
  (*F++) ();
62
 
63
  return 0;
64
}

powered by: WebSVN 2.1.0

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