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.c-torture/] [execute/] [pr34456.c] - Diff between revs 297 and 338

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

Rev 297 Rev 338
#include <stdlib.h>
#include <stdlib.h>
 
 
int __attribute__ ((noinline)) debug (void) { return 1; }
int __attribute__ ((noinline)) debug (void) { return 1; }
int errors;
int errors;
 
 
struct s { int elt; int (*compare) (int); };
struct s { int elt; int (*compare) (int); };
 
 
static int
static int
compare (const void *x, const void *y)
compare (const void *x, const void *y)
{
{
  const struct s *s1 = x, *s2 = y;
  const struct s *s1 = x, *s2 = y;
  int (*compare1) (int);
  int (*compare1) (int);
  int elt2;
  int elt2;
 
 
  compare1 = s1->compare;
  compare1 = s1->compare;
  elt2 = s2->elt;
  elt2 = s2->elt;
  if (elt2 != 0 && debug () && compare1 (s1->elt) != 0)
  if (elt2 != 0 && debug () && compare1 (s1->elt) != 0)
    errors++;
    errors++;
  return compare1 (elt2);
  return compare1 (elt2);
}
}
 
 
int bad_compare (int x) { return -x; }
int bad_compare (int x) { return -x; }
struct s array[2] = { { 1, bad_compare }, { -1, bad_compare } };
struct s array[2] = { { 1, bad_compare }, { -1, bad_compare } };
 
 
int
int
main (void)
main (void)
{
{
  qsort (array, 2, sizeof (struct s), compare);
  qsort (array, 2, sizeof (struct s), compare);
  return errors == 0;
  return errors == 0;
}
}
 
 

powered by: WebSVN 2.1.0

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