blob: b68866c2b048b4aaec5f6af214404a43da72d720 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#define MAX (sizeof(int) * __CHAR_BIT__)
static int lmax(int a)
{
return 1 << MAX;
}
static int lneg(int a)
{
return 1 << -1;
}
static int rmax(int a)
{
return 1 >> MAX;
}
static int rneg(int a)
{
return 1 >> -1;
}
/*
* check-name: bad-shift
* check-command: test-linearize -Wno-decl $file
*
* check-output-start
lmax:
.L0:
<entry-point>
shl.32 %r1 <- $1, $32
ret.32 %r1
lneg:
.L2:
<entry-point>
shl.32 %r3 <- $1, $0xffffffff
ret.32 %r3
rmax:
.L4:
<entry-point>
asr.32 %r5 <- $1, $32
ret.32 %r5
rneg:
.L6:
<entry-point>
asr.32 %r7 <- $1, $0xffffffff
ret.32 %r7
* check-output-end
*
* check-error-start
expand/bad-shift.c:5:21: warning: shift too big (32) for type int
expand/bad-shift.c:10:21: warning: shift count is negative (-1)
expand/bad-shift.c:15:21: warning: shift too big (32) for type int
expand/bad-shift.c:20:21: warning: shift count is negative (-1)
* check-error-end
*/
|