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

Stage2 panics when continue jumps to outer (inline) loop #13038

Closed
briangold opened this issue Oct 2, 2022 · 0 comments
Closed

Stage2 panics when continue jumps to outer (inline) loop #13038

briangold opened this issue Oct 2, 2022 · 0 comments
Labels
bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone

Comments

@briangold
Copy link
Contributor

Zig Version

0.10.0-dev.4213+91b05ad47

Steps to Reproduce

Reduced from a larger test case. Crash only happens with comptime (inline) loops, and both while loop and for loop hit this issue. Does not crash with -fstage1.

test {
    loop: inline for ([_]u8{ 1, 2 }) |x| {
        inline for ([_]u8{1}) |y| {
            if (comptime x == y) {
                continue :loop;
            }
        }
    }
}

Expected Behavior

Test should pass

Actual Behavior

Compiler panics with an attempt to use null value:

thread 255071 panic: attempt to use null value
/build/zig/src/Sema.zig:1169:25: 0x644bb1f in analyzeBodyInner (zig)
/build/zig/src/Sema.zig:15334:37: 0x668c7df in zirCondbr (zig)
/build/zig/src/Sema.zig:1347:61: 0x644e133 in analyzeBodyInner (zig)
/build/zig/src/Sema.zig:4972:34: 0x68a73d7 in resolveBlockBody (zig)
/build/zig/src/Sema.zig:4955:33: 0x668a83f in zirBlock (zig)
/build/zig/src/Sema.zig:1250:69: 0x644cbc7 in analyzeBodyInner (zig)
/build/zig/src/Sema.zig:628:45: 0x6277c5f in analyzeBodyBreak (zig)
/build/zig/src/Sema.zig:1376:62: 0x644ef23 in analyzeBodyInner (zig)
/build/zig/src/Sema.zig:628:45: 0x6277c5f in analyzeBodyBreak (zig)
/build/zig/src/Sema.zig:1296:65: 0x644d603 in analyzeBodyInner (zig)
/build/zig/src/Sema.zig:628:45: 0x6277c5f in analyzeBodyBreak (zig)
/build/zig/src/Sema.zig:1296:65: 0x644d603 in analyzeBodyInner (zig)
/build/zig/src/Sema.zig:628:45: 0x6277c5f in analyzeBodyBreak (zig)
/build/zig/src/Sema.zig:1376:62: 0x644ef23 in analyzeBodyInner (zig)
/build/zig/src/Sema.zig:628:45: 0x6277c5f in analyzeBodyBreak (zig)
/build/zig/src/Sema.zig:1296:65: 0x644d603 in analyzeBodyInner (zig)
/build/zig/src/Sema.zig:628:45: 0x6277c5f in analyzeBodyBreak (zig)
/build/zig/src/Sema.zig:1296:65: 0x644d603 in analyzeBodyInner (zig)
/build/zig/src/Sema.zig:611:30: 0x643b8e3 in analyzeBody (zig)
/build/zig/src/Module.zig:5591:21: 0x62619d3 in analyzeFnBody (zig)
/build/zig/src/Module.zig:4291:40: 0x6049913 in ensureFuncBodyAnalyzed (zig)
/build/zig/src/Compilation.zig:3047:42: 0x6047ed7 in processOneJob (zig)
/build/zig/src/Compilation.zig:2985:30: 0x5f3a2af in performAllTheWork (zig)
/build/zig/src/Compilation.zig:2325:31: 0x5f36cf7 in update (zig)
/build/zig/src/main.zig:3376:20: 0x5f5c03b in updateModule (zig)
/build/zig/src/main.zig:3061:17: 0x5cfe6af in buildOutputType (zig)
/build/zig/src/main.zig:236:31: 0x5cdc307 in mainArgs (zig)
/build/zig/src/stage1.zig:48:24: 0x5fa93bb in main (zig)
@briangold briangold added the bug Observed behavior contradicts documented or intended behavior label Oct 2, 2022
@Vexu Vexu added the frontend Tokenization, parsing, AstGen, Sema, and Liveness. label Oct 3, 2022
@Vexu Vexu added this to the 0.10.0 milestone Oct 3, 2022
Vexu added a commit to Vexu/zig that referenced this issue Oct 5, 2022
Vexu added a commit to Vexu/zig that referenced this issue Oct 5, 2022
Vexu added a commit to Vexu/zig that referenced this issue Oct 5, 2022
@Vexu Vexu closed this as completed in b626977 Oct 10, 2022
topolarity added a commit to topolarity/zig that referenced this issue Oct 15, 2022
This PR (ziglang#12873) in combination with this particular test exposed
a pre-existing bug (ziglang#13175).

This means that the test for ziglang#13038 has regressed.
topolarity added a commit to topolarity/zig that referenced this issue Oct 15, 2022
This PR (ziglang#12873) in combination with this particular test exposed
a pre-existing bug (ziglang#13175).

This means that the test for ziglang#13038 has regressed.
topolarity added a commit to topolarity/zig that referenced this issue Oct 15, 2022
This PR (ziglang#12873) in combination with this particular test exposed
a pre-existing bug (ziglang#13175).

This means that the test for ziglang#13038 has regressed.
topolarity added a commit to topolarity/zig that referenced this issue Oct 16, 2022
This PR (ziglang#12873) in combination with this particular test exposed
a pre-existing bug (ziglang#13175).

This means that the test for ziglang#13038 has regressed
topolarity added a commit to topolarity/zig that referenced this issue Oct 20, 2022
This PR (ziglang#12873) in combination with this particular test exposed
a pre-existing bug (ziglang#13175).

This means that the test for ziglang#13038 has regressed
topolarity added a commit to topolarity/zig that referenced this issue Oct 21, 2022
This PR (ziglang#12873) in combination with this particular test exposed
a pre-existing bug (ziglang#13175).

This means that the test for ziglang#13038 has regressed
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 frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Projects
None yet
Development

No branches or pull requests

2 participants