Skip to content

segfault when compiling struct with optional list of self #1735

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
daurnimator opened this issue Nov 17, 2018 · 3 comments
Closed

segfault when compiling struct with optional list of self #1735

daurnimator opened this issue Nov 17, 2018 · 3 comments
Labels
bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@daurnimator
Copy link
Contributor

const std = @import("std");

const mystruct = struct {
    pending: ?listofstructs,
};
const listofstructs = std.LinkedList(mystruct);

const a = struct {
    const Self = @This();

    foo: listofstructs,

    pub fn init() Self {
        return Self{
            .foo = listofstructs.init(),
        };
    }
};

test "intialization" {
    var t = a.init();
}
$ zig version
0.3.0+38629628
                Stack trace of thread 18153:
                #0  0x0000558bc81aa26c n/a (zig)
                #1  0x0000558bc81ee5d0 n/a (zig)
                #2  0x0000558bc8217e8a n/a (zig)
                #3  0x0000558bc821a501 _Z10ir_analyzeP7CodeGenP12IrExecutableS2_P7ZigTypeP7AstNode (zig)
                #4  0x0000558bc821a799 _Z19ir_eval_const_valueP7CodeGenP5ScopeP7AstNodeP7ZigTypePmmP5ZigFnP3BufS4_SB_P12IrExecutable (zig)
                #5  0x0000558bc81a03f2 _Z17analyze_type_exprP7CodeGenP5ScopeP7AstNode (zig)
                #6  0x0000558bc81a9df7 n/a (zig)
                #7  0x0000558bc81a9e46 n/a (zig)
                #8  0x0000558bc81f7c39 n/a (zig)
                #9  0x0000558bc8218758 n/a (zig)
                #10 0x0000558bc821a501 _Z10ir_analyzeP7CodeGenP12IrExecutableS2_P7ZigTypeP7AstNode (zig)
                #11 0x0000558bc821a799 _Z19ir_eval_const_valueP7CodeGenP5ScopeP7AstNodeP7ZigTypePmmP5ZigFnP3BufS4_SB_P12IrExecutable (zig)
                #12 0x0000558bc81a03f2 _Z17analyze_type_exprP7CodeGenP5ScopeP7AstNode (zig)
                #13 0x0000558bc81a9df7 n/a (zig)
                #14 0x0000558bc81a9e46 n/a (zig)
                #15 0x0000558bc81aedd4 n/a (zig)
                #16 0x0000558bc81e9863 n/a (zig)
                #17 0x0000558bc821533a n/a (zig)
                #18 0x0000558bc8217e25 n/a (zig)
                #19 0x0000558bc821a501 _Z10ir_analyzeP7CodeGenP12IrExecutableS2_P7ZigTypeP7AstNode (zig)
                #20 0x0000558bc81b0576 _Z13analyze_fn_irP7CodeGenP5ZigFnP7AstNode (zig)
                #21 0x0000558bc81b1260 _Z16semantic_analyzeP7CodeGen (zig)
                #22 0x0000558bc81da7d1 _Z22codegen_build_and_linkP7CodeGen (zig)
                #23 0x0000558bc81947bf main (zig)
                #24 0x00007fd8be99e223 __libc_start_main (libc.so.6)
                #25 0x0000558bc819e68e _start (zig)
@andrewrk andrewrk added this to the 0.4.0 milestone Nov 17, 2018
@andrewrk andrewrk added the bug Observed behavior contradicts documented or intended behavior label Nov 17, 2018
@daurnimator
Copy link
Contributor Author

Is this a duplicate of #1657?

@tgschultz
Copy link
Contributor

See also: #1805

@andrewrk
Copy link
Member

andrewrk commented Apr 4, 2019

Proposal to fix this: #2174

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

3 participants