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

Setting an individual element of a vector of u1 sets all elements #13925

Closed
notcancername opened this issue Dec 13, 2022 · 1 comment · Fixed by #13959
Closed

Setting an individual element of a vector of u1 sets all elements #13925

notcancername opened this issue Dec 13, 2022 · 1 comment · Fixed by #13959
Labels
bug Observed behavior contradicts documented or intended behavior regression It worked in a previous version of Zig, but stopped working.
Milestone

Comments

@notcancername
Copy link
Contributor

Zig Version

0.11.0-dev.672+e94504543

Steps to Reproduce and Observed Behavior

  1. Compile this code with zig build-exe on x86_64
const std = @import("std");

pub fn main() void {
    var v = @Vector(4, u1){1, 1, 1, 1};
    std.debug.print("{any}\n", .{v}); // { 1, 1, 1, 1 }
    v[0] = 0;
    std.debug.print("{any}\n", .{v}); // expected { 0, 1, 1, 1}, got {0, 0, 0, 0}
}
  1. Run the generated executable. Observe that the output does not match the expected output.

Expected Behavior

I expected the generated executable to print

{ 1, 1, 1, 1 }
{ 1, 1, 1, 1}

, but it printed

{ 1, 1, 1, 1 }
{ 0, 0, 0, 0 }

.

@notcancername notcancername added the bug Observed behavior contradicts documented or intended behavior label Dec 13, 2022
@nektro
Copy link
Contributor

nektro commented Dec 13, 2022

different but related: #13279

@Vexu Vexu added this to the 0.10.1 milestone Dec 15, 2022
@Vexu Vexu added the regression It worked in a previous version of Zig, but stopped working. label Dec 15, 2022
Vexu added a commit to Vexu/zig that referenced this issue Dec 15, 2022
Vexu added a commit to Vexu/zig that referenced this issue Dec 15, 2022
Vexu added a commit to Vexu/zig that referenced this issue Dec 15, 2022
andrewrk pushed a commit that referenced this issue Dec 16, 2022
TUSF pushed a commit to TUSF/zig that referenced this issue May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior regression It worked in a previous version of Zig, but stopped working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants