repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git]
/
gcc
/
testsuite
/
gcc.c-torture
/
execute
/
switch-1.c
blob
22565576413f8e56657b68b0f21b06cb47f6c5fe
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
()
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