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
2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git]
/
gcc
/
testsuite
/
gcc.c-torture
/
execute
/
shiftopt-1.c
blob
fa9517a73dbb2a6b7671a81aba92c63952777c77
1
/* Copyright (C) 2002 Free Software Foundation
2
3
Check that constant folding of shift operations is working.
4
5
Roger Sayle, 10th October 2002. */
6
7
extern
void
abort
(
void
);
8
extern
void
link_error
(
void
);
9
10
void
11
utest
(
unsigned int
x
)
12
{
13
if
(
x
>>
0
!=
x
)
14
link_error
();
15
16
if
(
x
<<
0
!=
x
)
17
link_error
();
18
19
if
(
0
<<
x
!=
0
)
20
link_error
();
21
22
if
(
0
>>
x
!=
0
)
23
link_error
();
24
25
if
(-
1
>>
x
!= -
1
)
26
link_error
();
27
28
if
(~
0
>>
x
!= ~
0
)
29
link_error
();
30
}
31
32
void
33
stest
(
int
x
)
34
{
35
if
(
x
>>
0
!=
x
)
36
link_error
();
37
38
if
(
x
<<
0
!=
x
)
39
link_error
();
40
41
if
(
0
<<
x
!=
0
)
42
link_error
();
43
44
if
(
0
>>
x
!=
0
)
45
link_error
();
46
47
if
(-
1
>>
x
!= -
1
)
48
link_error
();
49
50
if
(~
0
>>
x
!= ~
0
)
51
link_error
();
52
}
53
54
int
55
main
()
56
{
57
utest
(
9
);
58
utest
(
0
);
59
60
stest
(
9
);
61
stest
(
0
);
62
63
return
0
;
64
}
65
66
#ifndef __OPTIMIZE__
67
void
68
link_error
()
69
{
70
abort
();
71
}
72
#endif
73