Skip to content

Commit adbc95a

Browse files
committed
Fixed SIGILL in stack_alignment test
1 parent 7f53d61 commit adbc95a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/context.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,20 +174,18 @@ mod tests {
174174
#[test]
175175
fn stack_alignment() {
176176
extern "C" fn context_function(t: Transfer) -> ! {
177-
let i = [0u8; 512];
178-
assert_eq!(&i as *const _ as usize % 16, 0);
179-
180-
t.context.resume(0);
177+
let i: [u8; 512] = unsafe { mem::uninitialized() };
178+
t.context.resume(&i as *const _ as usize % 16);
181179
unreachable!();
182180
}
183181

184182
let stack = ProtectedFixedSizeStack::default();
185183
assert_eq!(stack.top() as usize % 16, 0);
186184
assert_eq!(stack.bottom() as usize % 16, 0);
187185

188-
let t = Transfer::new(Context::new(&stack, context_function), 0);
189-
190-
t.context.resume(0);
186+
let mut t = Transfer::new(Context::new(&stack, context_function), 0);
187+
t = t.context.resume(0);
188+
assert_eq!(t.data, 0);
191189
}
192190

193191
#[test]

0 commit comments

Comments
 (0)