File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,20 @@ pub fn box_uninitialized2() -> Box<MaybeUninit<[usize; 1024 * 1024]>> {
25
25
Box :: new ( MaybeUninit :: uninit ( ) )
26
26
}
27
27
28
+ #[ repr( align( 1024 ) ) ]
29
+ pub struct LotsaPadding ( usize ) ;
30
+
31
+ // Boxing a value with padding should not copy junk from the stack
32
+ #[ no_mangle]
33
+ pub fn box_lotsa_padding ( ) -> Box < LotsaPadding > {
34
+ // CHECK-LABEL: @box_lotsa_padding
35
+ // CHECK-NOT: alloca
36
+ // CHECK-NOT: getelementptr
37
+ // CHECK-NOT: memcpy
38
+ // CHECK-NOT: memset
39
+ Box :: new ( LotsaPadding ( 42 ) )
40
+ }
41
+
28
42
// Hide the `allocalign` attribute in the declaration of __rust_alloc
29
43
// from the CHECK-NOT above, and also verify the attributes got set reasonably.
30
44
// CHECK: declare {{(dso_local )?}}noalias noundef ptr @__rust_alloc(i{{[0-9]+}} noundef, i{{[0-9]+}} allocalign noundef) unnamed_addr [[RUST_ALLOC_ATTRS:#[0-9]+]]
You can’t perform that action at this time.
0 commit comments