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

Crash: assign to pointer to incomplete enum #681

Closed
ehaas opened this issue Apr 12, 2024 · 0 comments
Closed

Crash: assign to pointer to incomplete enum #681

ehaas opened this issue Apr 12, 2024 · 0 comments
Labels
bug Something isn't working crash A bug that causes the compiler to crash

Comments

@ehaas
Copy link
Collaborator

ehaas commented Apr 12, 2024

void foo(void) {
   int x;
   enum E *ptr = &x;
}
panic: reached unreachable code
/Users/ehaas/source/arocc/src/aro/Type.zig:1317:17: 0x10e7e3f95 in integerRank (arocc)
        else => unreachable,
                ^
/Users/ehaas/source/arocc/src/aro/Type.zig:1324:22: 0x10e8ee58d in sameRankDifferentSign (arocc)
    if (a.integerRank(comp) != b.integerRank(comp)) return false;
                     ^
/Users/ehaas/source/arocc/src/aro/Parser.zig:6122:87: 0x10e877c6e in coerceExtra (arocc)
                const different_sign_only = unqual_ty.elemType().sameRankDifferentSign(res.ty.elemType(), p.comp);
                                                                                      ^
/Users/ehaas/source/arocc/src/aro/Parser.zig:6055:31: 0x10e8b68a7 in coerce (arocc)
        return res.coerceExtra(p, dest_ty, tok, c) catch |er| switch (er) {
                              ^
@ehaas ehaas added bug Something isn't working crash A bug that causes the compiler to crash labels Apr 12, 2024
ehaas added a commit to ehaas/arocc that referenced this issue Apr 16, 2024
@Vexu Vexu closed this as completed in 9aeacf0 Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crash A bug that causes the compiler to crash
Projects
None yet
Development

No branches or pull requests

1 participant