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.c-torture/] [execute/] [20020402-1.c] - Blame information for rev 308

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

Line No. Rev Author Line
1 297 jeremybenn
/* derived from PR c/2100 */
2
 
3
extern void abort ();
4
extern void exit (int);
5
 
6
#define SMALL_N  2
7
#define NUM_ELEM 4
8
 
9
int main(void)
10
{
11
  int listElem[NUM_ELEM]={30,2,10,5};
12
  int listSmall[SMALL_N];
13
  int i, j;
14
  int posGreatest=-1, greatest=-1;
15
 
16
  for (i=0; i<SMALL_N; i++) {
17
    listSmall[i] = listElem[i];
18
    if (listElem[i] > greatest) {
19
      posGreatest = i;
20
      greatest = listElem[i];
21
    }
22
  }
23
 
24
  for (i=SMALL_N; i<NUM_ELEM; i++) {
25
    if (listElem[i] < greatest) {
26
      listSmall[posGreatest] = listElem[i];
27
      posGreatest = 0;
28
      greatest = listSmall[0];
29
      for (j=1; j<SMALL_N; j++)
30
        if (listSmall[j] > greatest) {
31
          posGreatest = j;
32
          greatest = listSmall[j];
33
        }
34
    }
35
  }
36
 
37
  if (listSmall[0] != 5 || listSmall[1] != 2)
38
    abort ();
39
  exit (0);
40
}
41
 

powered by: WebSVN 2.1.0

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