OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [pr34456.c] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
#include <stdlib.h>
2
 
3
int __attribute__ ((noinline)) debug (void) { return 1; }
4
int errors;
5
 
6
struct s { int elt; int (*compare) (int); };
7
 
8
static int
9
compare (const void *x, const void *y)
10
{
11
  const struct s *s1 = x, *s2 = y;
12
  int (*compare1) (int);
13
  int elt2;
14
 
15
  compare1 = s1->compare;
16
  elt2 = s2->elt;
17
  if (elt2 != 0 && debug () && compare1 (s1->elt) != 0)
18
    errors++;
19
  return compare1 (elt2);
20
}
21
 
22
int bad_compare (int x) { return -x; }
23
struct s array[2] = { { 1, bad_compare }, { -1, bad_compare } };
24
 
25
int
26
main (void)
27
{
28
  qsort (array, 2, sizeof (struct s), compare);
29
  return errors == 0;
30
}

powered by: WebSVN 2.1.0

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