Skip to content

Bug on non-power-of-2 SIMD vectors #20460

Closed
@simnalamburt

Description

@simnalamburt

I think I found a bug with non-power-of-2 SIMD vectors. They're randomly turned into zero values when I store them on Vec

http://is.gd/LfOHbj

#[simd]
#[deriving(Show)]
struct f32x3(f32, f32, f32);

fn main() {
    let mut points = Vec::new();

    for _ in 0i..10 {
        points.push(f32x3(1.0, 1.0, 1.0));
    }

    for point in points.iter() {
        println!("{}", point);
    }
}

Expected result:

f32x3(1, 1, 1)
f32x3(1, 1, 1)
f32x3(1, 1, 1)
f32x3(1, 1, 1)
f32x3(1, 1, 1)
f32x3(1, 1, 1)
f32x3(1, 1, 1)
f32x3(1, 1, 1)
f32x3(1, 1, 1)
f32x3(1, 1, 1)

What we get:

f32x3(1, 1, 1)
f32x3(1, 1, 1)
f32x3(1, 1, 1)
f32x3(0, 0, 0)
f32x3(1, 1, 1)
f32x3(1, 1, 1)
f32x3(0, 0, 0)
f32x3(0, 0, 0)
f32x3(1, 1, 1)
f32x3(1, 1, 1)

Tested with:

rustc 0.13.0-nightly (39d740266 2015-01-01 15:51:08 +0000)
host: x86_64-apple-darwin
rustc 0.13.0-nightly (39d740266 2015-01-01 15:51:08 +0000)
host: x86_64-unknown-linux-gnu (Ubuntu 14.04.1 LTS)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions