Skip to content

Compiler crash when taking slice of zero-length array #788

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

Closed
ghost opened this issue Feb 24, 2018 · 0 comments
Closed

Compiler crash when taking slice of zero-length array #788

ghost opened this issue Feb 24, 2018 · 0 comments
Labels
bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@ghost
Copy link

ghost commented Feb 24, 2018

Test cases:
pub fn main() void { ([]u32{})[0..]; }
pub fn main() void { ""[0..]; }

Compiler version: 0.1.1.8db7a142
Compiler output:

zig/src/analyze.cpp:394: TypeTableEntry* get_pointer_to_type_extra(CodeGen*, TypeTableEntry*, bool, bool, uint32_t, uint32_t, uint32_t): Assertion `byte_alignment > 0' failed.

@ghost ghost changed the title Compiler crash when taking slice of zero-length string Compiler crash when taking slice of zero-length array Feb 24, 2018
@tiehuis tiehuis added the bug Observed behavior contradicts documented or intended behavior label Feb 24, 2018
@andrewrk andrewrk added this to the 0.2.0 milestone Feb 25, 2018
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
Projects
None yet
Development

No branches or pull requests

2 participants