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

Recursive infinite comptime fn loop segfaults/stack overflows the compiler #18740

Closed
Jarred-Sumner opened this issue Jan 30, 2024 · 2 comments
Closed
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@Jarred-Sumner
Copy link
Contributor

Zig Version

0.12.0-dev.1830+779b8e259

Steps to Reproduce and Observed Behavior

  1. Code
pub fn PosixBufferedOutputReader(comptime Parent: type) type {
    return struct {
        pub usingnamespace PosixBufferedOutputReader(
            @This(),
        );

        pub fn get(comptime T: type) *Parent {
            return Parent.get(T);
        }
    };
}

test {
    _ = PosixBufferedOutputReader(struct {
        pub fn get() *@This() {
            return undefined;
        }
    }).get();
}
  1. Run
Semantic Analysis [16218] fish: Job 1, 'zig test /Users/jarred/Desktop/…' terminated by signal SIGSEGV (Address boundary error)

Expected Behavior

Zig detects that it is an infinite loop and returns two compiler errors (one for the error in the code, one for the infinite loop) instead of a segmentation fault

@Jarred-Sumner Jarred-Sumner added the bug Observed behavior contradicts documented or intended behavior label Jan 30, 2024
@Vexu
Copy link
Member

Vexu commented Jan 30, 2024

Duplicate of the poorly titled issue #13380

@Vexu Vexu closed this as not planned Won't fix, can't repro, duplicate, stale Jan 30, 2024
@Vexu
Copy link
Member

Vexu commented Jan 30, 2024

See also #13724

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