@@ -11,169 +11,169 @@ uint64_t f0(uint64_t);
11
11
uint64_t f1 (uint64_t , uint32_t );
12
12
uint64_t f2 (uint64_t , ...);
13
13
14
- static const uint64_t overflow = 1 * 4608 * 1024 * 1024 ; // expected-warning {{overflow in expression; result is 536870912 with type 'int'}}
14
+ static const uint64_t overflow = 1 * 4608 * 1024 * 1024 ; // expected-warning {{overflow in expression; result is 536'870'912 with type 'int'}}
15
15
16
16
uint64_t check_integer_overflows (int i ) {
17
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
17
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
18
18
uint64_t overflow = 4608 * 1024 * 1024 ,
19
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
19
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
20
20
overflow2 = (uint64_t )(4608 * 1024 * 1024 ),
21
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
21
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
22
22
overflow3 = (uint64_t )(4608 * 1024 * 1024 * i ),
23
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
23
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
24
24
overflow4 = (1ULL * ((4608 ) * ((1024 ) * (1024 ))) + 2ULL ),
25
- // expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
25
+ // expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
26
26
multi_overflow = (uint64_t )((uint64_t )(4608 * 1024 * 1024 ) * (uint64_t )(4608 * 1024 * 1024 ));
27
27
28
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
28
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
29
29
overflow += overflow2 = overflow3 = (uint64_t )(4608 * 1024 * 1024 );
30
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
30
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
31
31
overflow += overflow2 = overflow3 = 4608 * 1024 * 1024 ;
32
32
33
33
uint64_t not_overflow = 4608 * 1024 * 1024ULL ;
34
34
uint64_t not_overflow2 = (1ULL * ((uint64_t )(4608 ) * (1024 * 1024 )) + 2ULL );
35
35
36
- // expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
36
+ // expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
37
37
overflow = 4608 * 1024 * 1024 ? 4608 * 1024 * 1024 : 0 ;
38
38
39
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
39
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
40
40
overflow = 0 ? 0 : 4608 * 1024 * 1024 ;
41
41
42
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
42
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
43
43
if (4608 * 1024 * 1024 )
44
44
return 0 ;
45
45
46
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
46
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
47
47
if ((uint64_t )(4608 * 1024 * 1024 ))
48
48
return 1 ;
49
49
50
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
50
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
51
51
if ((uint64_t )(4608 * 1024 * 1024 ))
52
52
return 2 ;
53
53
54
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
54
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
55
55
if ((uint64_t )(4608 * 1024 * 1024 * i ))
56
56
return 3 ;
57
57
58
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
58
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
59
59
if ((1ULL * ((4608 ) * ((1024 ) * (1024 ))) + 2ULL ))
60
60
return 4 ;
61
61
62
- // expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
62
+ // expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
63
63
if ((uint64_t )((uint64_t )(4608 * 1024 * 1024 ) * (uint64_t )(4608 * 1024 * 1024 )))
64
64
return 5 ;
65
65
66
66
switch (i ) {
67
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
67
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
68
68
case 4608 * 1024 * 1024 :
69
69
return 6 ;
70
- // expected-warning@+1 {{overflow in expression; result is 537919488 with type 'int'}}
70
+ // expected-warning@+1 {{overflow in expression; result is 537'919'488 with type 'int'}}
71
71
case (uint64_t )(4609 * 1024 * 1024 ):
72
72
return 7 ;
73
73
// expected-error@+1 {{expression is not an integer constant expression}}
74
74
case ((uint64_t )(4608 * 1024 * 1024 * i )):
75
75
return 8 ;
76
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
76
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
77
77
case ((1ULL * ((4608 ) * ((1024 ) * (1024 ))) + 2ULL )):
78
78
return 9 ;
79
- // expected-warning@+2 2{{overflow in expression; result is 536870912 with type 'int'}}
79
+ // expected-warning@+2 2{{overflow in expression; result is 536'870'912 with type 'int'}}
80
80
// expected-warning@+1 {{overflow converting case value to switch condition type (288230376151711744 to 0)}}
81
81
case ((uint64_t )((uint64_t )(4608 * 1024 * 1024 ) * (uint64_t )(4608 * 1024 * 1024 ))):
82
82
return 10 ;
83
83
}
84
84
85
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
85
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
86
86
while (4608 * 1024 * 1024 );
87
87
88
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
88
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
89
89
while ((uint64_t )(4608 * 1024 * 1024 ));
90
90
91
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
91
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
92
92
while ((uint64_t )(4608 * 1024 * 1024 ));
93
93
94
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
94
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
95
95
while ((uint64_t )(4608 * 1024 * 1024 * i ));
96
96
97
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
97
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
98
98
while ((1ULL * ((4608 ) * ((1024 ) * (1024 ))) + 2ULL ));
99
99
100
- // expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
100
+ // expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
101
101
while ((uint64_t )((uint64_t )(4608 * 1024 * 1024 ) * (uint64_t )(4608 * 1024 * 1024 )));
102
102
103
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
103
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
104
104
do { } while (4608 * 1024 * 1024 );
105
105
106
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
106
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
107
107
do { } while ((uint64_t )(4608 * 1024 * 1024 ));
108
108
109
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
109
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
110
110
do { } while ((uint64_t )(4608 * 1024 * 1024 ));
111
111
112
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
112
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
113
113
do { } while ((uint64_t )(4608 * 1024 * 1024 * i ));
114
114
115
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
115
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
116
116
do { } while ((1ULL * ((4608 ) * ((1024 ) * (1024 ))) + 2ULL ));
117
117
118
- // expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
118
+ // expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
119
119
do { } while ((uint64_t )((uint64_t )(4608 * 1024 * 1024 ) * (uint64_t )(4608 * 1024 * 1024 )));
120
120
121
- // expected-warning@+3 {{overflow in expression; result is 536870912 with type 'int'}}
122
- // expected-warning@+3 {{overflow in expression; result is 536870912 with type 'int'}}
123
- // expected-warning@+3 {{overflow in expression; result is 536870912 with type 'int'}}
121
+ // expected-warning@+3 {{overflow in expression; result is 536'870'912 with type 'int'}}
122
+ // expected-warning@+3 {{overflow in expression; result is 536'870'912 with type 'int'}}
123
+ // expected-warning@+3 {{overflow in expression; result is 536'870'912 with type 'int'}}
124
124
for (uint64_t i = 4608 * 1024 * 1024 ;
125
125
(uint64_t )(4608 * 1024 * 1024 );
126
126
i += (uint64_t )(4608 * 1024 * 1024 * i ));
127
127
128
- // expected-warning@+3 {{overflow in expression; result is 536870912 with type 'int'}}
129
- // expected-warning@+3 2{{overflow in expression; result is 536870912 with type 'int'}}
130
- // expected-warning@+3 2{{overflow in expression; result is 536870912 with type 'int'}}
128
+ // expected-warning@+3 {{overflow in expression; result is 536'870'912 with type 'int'}}
129
+ // expected-warning@+3 2{{overflow in expression; result is 536'870'912 with type 'int'}}
130
+ // expected-warning@+3 2{{overflow in expression; result is 536'870'912 with type 'int'}}
131
131
for (uint64_t i = (1ULL * ((4608 ) * ((1024 ) * (1024 ))) + 2ULL );
132
132
((uint64_t )((uint64_t )(4608 * 1024 * 1024 ) * (uint64_t )(4608 * 1024 * 1024 )));
133
133
i = ((4608 * 1024 * 1024 ) + ((uint64_t )(4608 * 1024 * 1024 ))));
134
134
135
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
135
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
136
136
_Complex long long x = 4608 * 1024 * 1024 ;
137
137
138
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
138
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
139
139
(__real__ x ) = 4608 * 1024 * 1024 ;
140
140
141
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
141
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
142
142
(__imag__ x ) = 4608 * 1024 * 1024 ;
143
143
144
- // expected-warning@+4 {{overflow in expression; result is 536870912 with type 'int'}}
144
+ // expected-warning@+4 {{overflow in expression; result is 536'870'912 with type 'int'}}
145
145
// expected-warning@+3 {{array index 536870912 is past the end of the array (that has type 'uint64_t[10]' (aka 'unsigned long long[10]'))}}
146
146
// expected-note@+1 {{array 'a' declared here}}
147
147
uint64_t a [10 ];
148
148
a [4608 * 1024 * 1024 ] = 1 i ;
149
149
150
- // expected-warning@+2 {{overflow in expression; result is 536870912 with type 'int'}}
150
+ // expected-warning@+2 {{overflow in expression; result is 536'870'912 with type 'int'}}
151
151
uint64_t * b ;
152
152
uint64_t b2 = b [4608 * 1024 * 1024 ] + 1 ;
153
153
154
- // expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
154
+ // expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
155
155
(void )((i ? (4608 * 1024 * 1024 ) : (4608 * 1024 * 1024 )) + 1 );
156
156
157
- // expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
157
+ // expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
158
158
return ((4608 * 1024 * 1024 ) + ((uint64_t )(4608 * 1024 * 1024 )));
159
159
}
160
160
161
161
void check_integer_overflows_in_function_calls (void ) {
162
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
162
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
163
163
(void )f0 (4608 * 1024 * 1024 );
164
164
165
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
165
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
166
166
uint64_t x = f0 (4608 * 1024 * 1024 );
167
167
168
- // expected-warning@+2 {{overflow in expression; result is 536870912 with type 'int'}}
168
+ // expected-warning@+2 {{overflow in expression; result is 536'870'912 with type 'int'}}
169
169
uint64_t (* f0_ptr )(uint64_t ) = & f0 ;
170
170
(void )(* f0_ptr )(4608 * 1024 * 1024 );
171
171
172
- // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
172
+ // expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
173
173
(void )f2 (0 , f0 (4608 * 1024 * 1024 ));
174
174
}
175
175
void check_integer_overflows_in_array_size (void ) {
176
- int arr [4608 * 1024 * 1024 ]; // expected-warning {{overflow in expression; result is 536870912 with type 'int'}}
176
+ int arr [4608 * 1024 * 1024 ]; // expected-warning {{overflow in expression; result is 536'870'912 with type 'int'}}
177
177
}
178
178
179
179
struct s {
0 commit comments