Skip to content

Nested literals with runtime slices causing weird compiler crashes #7650

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
fengb opened this issue Jan 2, 2021 · 3 comments
Closed

Nested literals with runtime slices causing weird compiler crashes #7650

fengb opened this issue Jan 2, 2021 · 3 comments
Milestone

Comments

@fengb
Copy link
Contributor

fengb commented Jan 2, 2021

This starts manifesting with struct literals 2 levels deep. This only seems to happen with runtime slices.

pub fn main() void {
    die("");
}

fn die(slice: []const u8) void {
    const working = .{
        .bar = slice,
        .baz = "",
    };

    const broken = .{
        .foo = .{
            .bar = slice,
            .baz = "", // this line creates a runtime bus error
        },
    };

    const really_broken = .{
        .foo = .{
            .bar = slice,
            .baz = .{}, // the compiler seg faults when having a third nested level
        },
    };
}
@fengb
Copy link
Contributor Author

fengb commented Jan 2, 2021

Possibly caused by the same issue as #6043

@ghost
Copy link

ghost commented Jan 2, 2021

Here's another similar looking one: #3915

@fengb
Copy link
Contributor Author

fengb commented Jan 2, 2021

Dupe of #7627

@fengb fengb closed this as completed Jan 2, 2021
@andrewrk andrewrk added this to the 0.8.0 milestone Jan 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants