Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEGFAULT in u8x16::store #33

Open
bheisler opened this issue Oct 4, 2016 · 1 comment
Open

SEGFAULT in u8x16::store #33

bheisler opened this issue Oct 4, 2016 · 1 comment

Comments

@bheisler
Copy link

bheisler commented Oct 4, 2016

This code segfaults when compiled by any version of rustc newer than nightly-2016-08-03 (in my case, I'm using 2016-09-30).

#[test]
fn test_store() {
    use simd::u8x16;
    let mut array = [0u8; 0x1000];
    let ones = u8x16::splat(1);
    ones.store(&mut array, 0);
    assert_eq!(array[0], 1);
    assert_eq!(array[15], 1);
    assert_eq!(array[16], 0);
}

Here's some output from gdb that might help:

0x000055555557b23f in simd::common::{{impl}}::store (self=..., array=..., idx=0) at /home/user/.cargo/git/checkouts/simd-a428b8cc9c1d1986/master/src/common.rs:137
137 *(place.as_mut_ptr() as *mut Unalign) = Unalign(self)

(gdb) p $_siginfo._sifields._sigfault
$3 = {si_addr = 0x0, _addr_lsb = 140727441239520, _addr_bnd = {_lower = 0x3, _upper = 0x1}}

Assuming GDB can be trusted here, it looks like rust is generating code that dereferences a null pointer.

@liebharc
Copy link
Contributor

I remember that I also ran into issues with this lib around that time. Recent Rust versions resolved the issue for me and also your example seems to work now with rustc 1.14.0-nightly (f09420685 2016-10-20), meaning that there is no segfault and all asserts are passed successfully. Not sure however what change caused the segfaults and how it got resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants