OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Fix PR 17408 and PR 17409.
[pf3gnuchains/gcc-fork.git]
/
gcc
/
testsuite
/
gcc.c-torture
/
execute
/
switch-1.c
1
/* 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