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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [switch-1.c] - Blame information for rev 711

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

Line No. Rev Author Line
1 688 jeremybenn
/* Copyright (C) 2003  Free Software Foundation.
2
 
3
   Test that switch statements suitable using case bit tests are
4
   implemented correctly.
5
 
6
   Written by Roger Sayle, 01/25/2001.  */
7
 
8
extern void abort (void);
9
 
10
int
11
foo (int x)
12
{
13
  switch (x)
14
    {
15
    case 4:
16
    case 6:
17
    case 9:
18
    case 11:
19
      return 30;
20
    }
21
  return 31;
22
}
23
 
24
int
25
main (int argc)
26
{
27
  int i, r;
28
 
29
  for (i=-1; i<66; i++)
30
    {
31
      r = foo (i);
32
      if (i == 4)
33
        {
34
          if (r != 30)
35
            abort ();
36
        }
37
      else if (i == 6)
38
        {
39
          if (r != 30)
40
            abort ();
41
        }
42
      else if (i == 9)
43
        {
44
          if (r != 30)
45
            abort ();
46
        }
47
      else if (i == 11)
48
        {
49
          if (r != 30)
50
            abort ();
51
        }
52
      else if (r != 31)
53
        abort ();
54
    }
55
  return 0;
56
}
57
 

powered by: WebSVN 2.1.0

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