Skip to content

Assertion failed at /deps/zig/src/ir.cpp:11865 in types_match_const_cast_only #4381

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
goshhhy opened this issue Feb 4, 2020 · 3 comments
Closed

Comments

@goshhhy
Copy link

goshhhy commented Feb 4, 2020

Semantic Analysis [304/635] Assertion failed at /deps/zig/src/ir.cpp:11865 in types_match_const_cast_only. This is a bug in the Zig compiler.
Unable to dump stack trace: debug info stripped
swimp_sdl...The following command terminated unexpectedly:
/snap/zig/1213/zig build-obj /home/sanae/code/fake2/src/platform/zigsdl/swimp_sdl.zig --library c --library SDL2 --cache-dir /home/sanae/code/fake2/zig-cache --name swimp_sdl -I /usr/include/SDL2 -I /home/sanae/code/fake2/src -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu -isystem /usr/include --library-path /usr/local/lib --library-path /usr/lib/x86_64-linux-gnu --library-path /usr/lib --library-path /lib/x86_64-linux-gnu -D _REENTRANT --cache on 

Build failed. The following command failed:
/home/sanae/code/fake2/zig-cache/o/EyDHokQvtENvJMzhQB_v1Ok5UhtEnO8-Y2Fg6iAdS9kkUKAOUPxpzW5aNbfMEpxV/build /snap/zig/1213/zig /home/sanae/code/fake2 /home/sanae/code/fake2/zig-cache

this error occurred while updating an project to the current edge build of zig, from 0.5.0.

this project is an in-place rewrite of a sizeable (~100,000 sloc) c89 codebase, and i have not yet been able to pare this down to a minimal standalone source file that reproduces the issue.

i can provide more information if needed.

@goshhhy
Copy link
Author

goshhhy commented Feb 4, 2020

the following files are all that are needed to reproduce this issue:

vid_sdl.zig

const c = @cImport({
    @cInclude("client.h");
});

extern fn VID_Printf (print_level: c_int, fmt: [*:0]u8, ...) void;

export fn VID_Init() void {
    var ri_local = c.refimport_t {
        .Con_Printf         = VID_Printf,
    };
}

client.h

typedef struct {
    void ( *Con_Printf )( int print_level, char *str, ... );
} refimport_t;

@LemonBoy
Copy link
Contributor

LemonBoy commented Feb 4, 2020

I believe this is fixed by #4359

@goshhhy
Copy link
Author

goshhhy commented Feb 4, 2020

@LemonBoy, I built zig from that tree and tried to build the project again, and came up with the same error.

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