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/] [tree-ssa/] [20040326-2.c] - Diff between revs 298 and 338

Only display areas with differences | Details | Blame | View Log

Rev 298 Rev 338
/* { dg-options "-O2 -fno-inline-functions" } */
/* { dg-options "-O2 -fno-inline-functions" } */
/* { dg-do run } */
/* { dg-do run } */
 
 
/* Gimplification problem exposed by zsh.  All the side-effects in
/* Gimplification problem exposed by zsh.  All the side-effects in
   function arguments and in the called expression should happen
   function arguments and in the called expression should happen
   before the actual function call.  */
   before the actual function call.  */
extern void abort (void);
extern void abort (void);
int A;
int A;
 
 
typedef void (*fnptr) (void);
typedef void (*fnptr) (void);
fnptr *F;
fnptr *F;
 
 
void
void
foo (int x)
foo (int x)
{
{
  if (A == x)
  if (A == x)
    abort ();
    abort ();
}
}
 
 
void
void
bar (int x, int y)
bar (int x, int y)
{
{
  if (x == 5 || y != 3)
  if (x == 5 || y != 3)
    abort ();
    abort ();
}
}
 
 
void
void
boz (void)
boz (void)
{
{
  abort ();
  abort ();
}
}
 
 
void
void
baz (void)
baz (void)
{
{
  if (*F != boz)
  if (*F != boz)
    abort ();
    abort ();
}
}
 
 
fnptr B[2] = { baz, boz };
fnptr B[2] = { baz, boz };
 
 
main ()
main ()
{
{
  int b, c;
  int b, c;
 
 
  /* The gimplifier was emitting A++ after the call to foo.  */
  /* The gimplifier was emitting A++ after the call to foo.  */
  A = 5;
  A = 5;
  foo (A++);
  foo (A++);
 
 
  /* The increment to 'b' and 'c' must happen before the call.  However,
  /* The increment to 'b' and 'c' must happen before the call.  However,
     the first argument to bar() must be the original value of 'b', while
     the first argument to bar() must be the original value of 'b', while
     the second argument must be the new value of 'c'.  */
     the second argument must be the new value of 'c'.  */
  b = 4;
  b = 4;
  c = 2;
  c = 2;
  bar (b++, ++c);
  bar (b++, ++c);
 
 
  /* This call via function pointer *F should go to baz, but F should
  /* This call via function pointer *F should go to baz, but F should
     be incremented before the actual call (i.e., right before the
     be incremented before the actual call (i.e., right before the
     call F should be pointing to boz).  */
     call F should be pointing to boz).  */
  F = &B[0];
  F = &B[0];
  (*F++) ();
  (*F++) ();
 
 
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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