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 compiling recursive code #17880

Closed
MFAshby opened this issue Nov 5, 2023 · 2 comments
Closed

Segfault compiling recursive code #17880

MFAshby opened this issue Nov 5, 2023 · 2 comments
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@MFAshby
Copy link

MFAshby commented Nov 5, 2023

Zig Version

0.12.0-dev.1396+f6de3ec96

Steps to Reproduce and Observed Behavior

Compile and run this program with zig run main.zig

https://gist.github.com/MFAshby/e6c7ccb871b91f7b5e0ee8c99172cff7#file-main-zig

Output is this, the compiler gets a segfault:

mfa@mfa ~> zig run main.zig
Semantic Analysis [12240] fish: Job 1, 'zig run main.zig' terminated by signal SIGSEGV (Address boundary error)

Expected Behavior

Program to compile and run, or emit an error message if there is invalid code.

@MFAshby MFAshby added the bug Observed behavior contradicts documented or intended behavior label Nov 5, 2023
@Vexu
Copy link
Member

Vexu commented Nov 5, 2023

Duplicate of #13724

@Vexu Vexu marked this as a duplicate of #13724 Nov 5, 2023
@Vexu Vexu closed this as not planned Won't fix, can't repro, duplicate, stale Nov 5, 2023
@MFAshby
Copy link
Author

MFAshby commented Nov 7, 2023

In case it's interesting at all, I worked around this issue by changing the recursive function arguments so they are known types rather than requiring recursive comptime evaluation.

fn bdecodeInner(a: std.mem.Allocator, base_reader: anytype) !BValue {

swapped for

fn bdecodeInner(a: std.mem.Allocator, base_reader: std.io.AnyReader) !BValue {

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