1
- //@ revisions: all strong basic none missing
1
+ //@ revisions: all strong basic none missing rusty
2
2
//@ assembly-output: emit-asm
3
3
//@ ignore-apple slightly different policy on stack protection of arrays
4
4
//@ ignore-msvc stack check code uses different function names
5
5
//@ ignore-nvptx64 stack protector is not supported
6
6
//@ ignore-wasm32-bare
7
7
//@ [all] compile-flags: -Z stack-protector=all
8
+ //@ [rusty] compile-flags: -Z stack-protector=rusty
8
9
//@ [strong] compile-flags: -Z stack-protector=strong
9
10
//@ [basic] compile-flags: -Z stack-protector=basic
10
11
//@ [none] compile-flags: -Z stack-protector=none
@@ -27,6 +28,8 @@ pub fn emptyfn() {
27
28
// basic-NOT: __stack_chk_fail
28
29
// none-NOT: __stack_chk_fail
29
30
// missing-NOT: __stack_chk_fail
31
+
32
+ // rusty-NOT: __stack_chk_fail
30
33
}
31
34
32
35
// CHECK-LABEL: array_char
@@ -45,6 +48,8 @@ pub fn array_char(f: fn(*const char)) {
45
48
// basic: __stack_chk_fail
46
49
// none-NOT: __stack_chk_fail
47
50
// missing-NOT: __stack_chk_fail
51
+
52
+ // rusty: __stack_chk_fail
48
53
}
49
54
50
55
// CHECK-LABEL: array_u8_1
@@ -61,6 +66,8 @@ pub fn array_u8_1(f: fn(*const u8)) {
61
66
// basic-NOT: __stack_chk_fail
62
67
// none-NOT: __stack_chk_fail
63
68
// missing-NOT: __stack_chk_fail
69
+
70
+ // rusty: __stack_chk_fail
64
71
}
65
72
66
73
// CHECK-LABEL: array_u8_small:
@@ -78,6 +85,8 @@ pub fn array_u8_small(f: fn(*const u8)) {
78
85
// basic-NOT: __stack_chk_fail
79
86
// none-NOT: __stack_chk_fail
80
87
// missing-NOT: __stack_chk_fail
88
+
89
+ // rusty: __stack_chk_fail
81
90
}
82
91
83
92
// CHECK-LABEL: array_u8_large:
@@ -94,6 +103,8 @@ pub fn array_u8_large(f: fn(*const u8)) {
94
103
// basic: __stack_chk_fail
95
104
// none-NOT: __stack_chk_fail
96
105
// missing-NOT: __stack_chk_fail
106
+
107
+ // rusty: __stack_chk_fail
97
108
}
98
109
99
110
#[ derive( Copy , Clone ) ]
@@ -113,6 +124,8 @@ pub fn array_bytesizednewtype_9(f: fn(*const ByteSizedNewtype)) {
113
124
// basic: __stack_chk_fail
114
125
// none-NOT: __stack_chk_fail
115
126
// missing-NOT: __stack_chk_fail
127
+
128
+ // rusty: __stack_chk_fail
116
129
}
117
130
118
131
// CHECK-LABEL: local_var_addr_used_indirectly
@@ -140,6 +153,8 @@ pub fn local_var_addr_used_indirectly(f: fn(bool)) {
140
153
// basic-NOT: __stack_chk_fail
141
154
// none-NOT: __stack_chk_fail
142
155
// missing-NOT: __stack_chk_fail
156
+
157
+ // rusty: __stack_chk_fail
143
158
}
144
159
145
160
// CHECK-LABEL: local_string_addr_taken
@@ -156,6 +171,8 @@ pub fn local_string_addr_taken(f: fn(&String)) {
156
171
// basic: __stack_chk_fail
157
172
// none-NOT: __stack_chk_fail
158
173
// missing-NOT: __stack_chk_fail
174
+
175
+ // rusty: __stack_chk_fail
159
176
}
160
177
161
178
pub trait SelfByRef {
@@ -185,6 +202,9 @@ pub fn local_var_addr_taken_used_locally_only(factory: fn() -> i32, sink: fn(i32
185
202
// basic-NOT: __stack_chk_fail
186
203
// none-NOT: __stack_chk_fail
187
204
// missing-NOT: __stack_chk_fail
205
+
206
+ // FIXME: rusty stack smash protection needs to support inline scenario detection
207
+ // rusty: __stack_chk_fail
188
208
}
189
209
190
210
pub struct Gigastruct {
@@ -222,6 +242,9 @@ pub fn local_large_var_moved(f: fn(Gigastruct)) {
222
242
// basic: __stack_chk_fail
223
243
// none-NOT: __stack_chk_fail
224
244
// missing-NOT: __stack_chk_fail
245
+
246
+ // FIXME: How does the rust compiler handle moves of large structures?
247
+ // rusty-NOT: __stack_chk_fail
225
248
}
226
249
227
250
// CHECK-LABEL: local_large_var_cloned
@@ -251,6 +274,9 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) {
251
274
// basic: __stack_chk_fail
252
275
// none-NOT: __stack_chk_fail
253
276
// missing-NOT: __stack_chk_fail
277
+
278
+ // FIXME: How does the rust compiler handle moves of large structures?
279
+ // rusty-NOT: __stack_chk_fail
254
280
}
255
281
256
282
extern "C" {
@@ -291,6 +317,11 @@ pub fn alloca_small_compile_time_constant_arg(f: fn(*mut ())) {
291
317
// basic-NOT: __stack_chk_fail
292
318
// none-NOT: __stack_chk_fail
293
319
// missing-NOT: __stack_chk_fail
320
+
321
+ // FIXME: Rusty thinks a function that returns a mutable raw pointer may
322
+ // be a stack memory allocation function, so it performs stack smash protection.
323
+ // Is it possible to optimize the heuristics?
324
+ // rusty: __stack_chk_fail
294
325
}
295
326
296
327
// CHECK-LABEL: alloca_large_compile_time_constant_arg
@@ -303,6 +334,8 @@ pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) {
303
334
// basic-NOT: __stack_chk_fail
304
335
// none-NOT: __stack_chk_fail
305
336
// missing-NOT: __stack_chk_fail
337
+
338
+ // rusty: __stack_chk_fail
306
339
}
307
340
308
341
// CHECK-LABEL: alloca_dynamic_arg
@@ -315,6 +348,8 @@ pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) {
315
348
// basic-NOT: __stack_chk_fail
316
349
// none-NOT: __stack_chk_fail
317
350
// missing-NOT: __stack_chk_fail
351
+
352
+ // rusty: __stack_chk_fail
318
353
}
319
354
320
355
// The question then is: in what ways can Rust code generate array-`alloca`
@@ -342,6 +377,9 @@ pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) {
342
377
// basic-NOT: __stack_chk_fail
343
378
// none-NOT: __stack_chk_fail
344
379
// missing-NOT: __stack_chk_fail
380
+
381
+ // FIXME: Does Rusty need to handle this type of optimization?
382
+ // rusty: __stack_chk_fail
345
383
}
346
384
347
385
// CHECK-LABEL: unsized_local
@@ -361,4 +399,6 @@ pub fn unsized_local(s: &[u8], l: bool, f: fn(&mut [u8])) {
361
399
// basic: __stack_chk_fail
362
400
// none-NOT: __stack_chk_fail
363
401
// missing-NOT: __stack_chk_fail
402
+
403
+ // rusty: __stack_chk_fail
364
404
}
0 commit comments