Skip to content

Passing &slice[0] as argument causes compiler assert when payload is zero sized #6947

Closed

Description

@SpexGuy
// repro.zig
pub fn destroy(ptr: *void) void {}

test "" {
    var slice: []void = undefined;
    destroy(&slice[0]);
}
> zig version
0.6.0+0088efc4b
> zig test repro.zig
Assertion failed at D:\a\1\s\src\stage1\codegen.cpp:3933 in ir_render_elem_ptr. This is a bug in the Zig compiler.
Unable to dump stack trace: debug info stripped

Activity

  1. added
    bug
    stage1
    on Nov 3, 2020
  2. modified the milestones: 0.8.0, 0.9.0 on Nov 3, 2020
  3. modified the milestones: 0.9.0, 0.10.0 on May 19, 2021
  4. modified the milestones: 0.12.0, 0.11.0 on Dec 10, 2022
  5. added a commit that references this issue on Dec 10, 2022
    18966bd
  6. added a commit that references this issue on May 9, 2024
    1880b9a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstage1

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions