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

Parser: Initializing incomplete array with non-array accesses inactive field of union #91

Closed
ehaas opened this issue Nov 13, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@ehaas
Copy link
Collaborator

ehaas commented Nov 13, 2021

int x;
int j[] = x;
➜  ~/source/arocc/zig-out/bin/arocc test.c
thread 18204944 panic: access of inactive union field
/Users/ehaas/source/arocc/src/Parser.zig:1210:64: 0x10671f5cb in Parser.initDeclarator (arocc)
            init_d.d.ty.data.array.len = init_list_expr.ty.data.array.len;
                                                               ^
/Users/ehaas/source/arocc/src/Parser.zig:585:39: 0x1066ed429 in Parser.decl (arocc)
    var init_d = (try p.initDeclarator(&decl_spec)) orelse {
                                      ^
/Users/ehaas/source/arocc/src/Parser.zig:462:19: 0x1066d922a in Parser.parse (arocc)
        if (p.decl() catch |er| switch (er) {
                  ^
/Users/ehaas/source/arocc/src/main.zig:257:32: 0x1066bbbb9 in processSource (arocc)
    var tree = try Parser.parse(&pp);
                               ^
/Users/ehaas/source/arocc/src/main.zig:223:22: 0x1066b0151 in handleArgs (arocc)
        processSource(comp, source, builtin, user_macros) catch |e| switch (e) {
                     ^
/Users/ehaas/source/arocc/src/main.zig:41:15: 0x1066ad2dd in main (arocc)
    handleArgs(&comp, args) catch |err| switch (err) {
              ^
/Users/ehaas/source/zig/build/lib/zig/std/start.zig:524:29: 0x10672ab0c in std.start.callMain (arocc)
            return root.main();
                            ^
/Users/ehaas/source/zig/build/lib/zig/std/start.zig:469:12: 0x1066b1257 in std.start.callMainWithArgs (arocc)
    return @call(.{ .modifier = .always_inline }, callMain, .{});
           ^
/Users/ehaas/source/zig/build/lib/zig/std/start.zig:434:12: 0x1066b1195 in std.start.main (arocc)
    return @call(.{ .modifier = .always_inline }, callMainWithArgs, .{ @intCast(usize, c_argc), c_argv, envp });
           ^
???:?:?: 0x7fff204ecf3c in ??? (???)
???:?:?: 0x1 in ??? (???)
[1]    79148 abort      ~/source/arocc/zig-out/bin/arocc test.c
@Vexu Vexu added the bug Something isn't working label Nov 13, 2021
@Vexu Vexu closed this as completed in f30adda Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants