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

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

Rev 298 Rev 338
/* PR middle-end/27959 */
/* PR middle-end/27959 */
/* { dg-do run { target { stdint_types } } } */
/* { dg-do run { target { stdint_types } } } */
/* { dg-options "-O2" } */
/* { dg-options "-O2" } */
/* { dg-options "-O2 -mtune=z990" { target s390*-*-* } } */
/* { dg-options "-O2 -mtune=z990" { target s390*-*-* } } */
 
 
#include <stdint.h>
#include <stdint.h>
extern void abort (void);
extern void abort (void);
 
 
struct B
struct B
{
{
  unsigned int b1, b2, b3;
  unsigned int b1, b2, b3;
  char b4;
  char b4;
};
};
 
 
struct C
struct C
{
{
  char c1;
  char c1;
};
};
 
 
struct D
struct D
{
{
  char *d1;
  char *d1;
  struct C **d2;
  struct C **d2;
  unsigned int d3;
  unsigned int d3;
};
};
 
 
void
void
__attribute__((noinline))
__attribute__((noinline))
foo (void *x, struct B *y, unsigned int *z)
foo (void *x, struct B *y, unsigned int *z)
{
{
  if (x)
  if (x)
    abort ();
    abort ();
  if (y->b1 != 7 || y->b2 != 5 || y->b3 != 3 || y->b4)
  if (y->b1 != 7 || y->b2 != 5 || y->b3 != 3 || y->b4)
    abort ();
    abort ();
  if (*z != 2)
  if (*z != 2)
    abort ();
    abort ();
}
}
 
 
int
int
__attribute__((noinline))
__attribute__((noinline))
baz (unsigned int *x, unsigned int y)
baz (unsigned int *x, unsigned int y)
{
{
  asm volatile ("" : : "r" (&x), "r" (&y) : "memory");
  asm volatile ("" : : "r" (&x), "r" (&y) : "memory");
  return *x + y;
  return *x + y;
}
}
 
 
inline int bar (unsigned int *x, unsigned int y)
inline int bar (unsigned int *x, unsigned int y)
{
{
  if (y < *x)
  if (y < *x)
    return 0;
    return 0;
  return baz (x, y);
  return baz (x, y);
}
}
 
 
unsigned int *
unsigned int *
__attribute__((noinline))
__attribute__((noinline))
test (struct D *x, unsigned int *y)
test (struct D *x, unsigned int *y)
{
{
  struct B b;
  struct B b;
  uint32_t c;
  uint32_t c;
 
 
  bar (y, x->d3);
  bar (y, x->d3);
  if ((*(x->d2))->c1)
  if ((*(x->d2))->c1)
    c = ((uint32_t) x->d1[0]
    c = ((uint32_t) x->d1[0]
         + ((uint32_t) x->d1[1] << 8)
         + ((uint32_t) x->d1[1] << 8)
         + ((uint32_t) x->d1[2] << 16)
         + ((uint32_t) x->d1[2] << 16)
         + ((uint32_t) x->d1[3] << 24));
         + ((uint32_t) x->d1[3] << 24));
  else
  else
    {
    {
      int32_t d;
      int32_t d;
      ((char *) &d)[0] = x->d1[0];
      ((char *) &d)[0] = x->d1[0];
      ((char *) &d)[1] = x->d1[1];
      ((char *) &d)[1] = x->d1[1];
      ((char *) &d)[2] = x->d1[2];
      ((char *) &d)[2] = x->d1[2];
      ((char *) &d)[3] = x->d1[3];
      ((char *) &d)[3] = x->d1[3];
      c = d;
      c = d;
    }
    }
  b.b4 = 0;
  b.b4 = 0;
  b.b1 = c / 10000L % 10000;
  b.b1 = c / 10000L % 10000;
  b.b2 = c / 100 % 100;
  b.b2 = c / 100 % 100;
  b.b3 = c % 100;
  b.b3 = c % 100;
  foo (0, &b, y);
  foo (0, &b, y);
  return y;
  return y;
}
}
 
 
int
int
main (void)
main (void)
{
{
  uint32_t x = 900070503;
  uint32_t x = 900070503;
  unsigned int y = 2;
  unsigned int y = 2;
  struct C c = { 0 }, *cptr = &c;
  struct C c = { 0 }, *cptr = &c;
  struct D d = { (char *) &x, &cptr, 0 };
  struct D d = { (char *) &x, &cptr, 0 };
  if (test (&d, &y) != &y)
  if (test (&d, &y) != &y)
    abort ();
    abort ();
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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