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

clang diagnostics broken in release modes #17952

Closed
xdBronch opened this issue Nov 10, 2023 · 1 comment
Closed

clang diagnostics broken in release modes #17952

xdBronch opened this issue Nov 10, 2023 · 1 comment
Labels
backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior

Comments

@xdBronch
Copy link
Contributor

Zig Version

0.12.0-dev.1571+03adafd80

Steps to Reproduce and Observed Behavior

int main() {
	int x = 0;
	float y = 1;
	float z = x & y;
}

zig build-exe repro.c
running this directly i get a compiler segfault, if using build.zig it says error(compilation): error.InvalidAbbrevId: failed to parse clang diagnostics
with a debug build of the compiler it works as presented in #17947

Expected Behavior

successful diagnostic parsing and no segfault

@xdBronch xdBronch added the bug Observed behavior contradicts documented or intended behavior label Nov 10, 2023
@jacobly0
Copy link
Member

reduced:

const testing = @import("std").testing;

test "pass nested union with rls" {
    const Union = union(enum) {
        a: u32,
        b: union(enum) {
            c: u7,
            d: u3,
        },

        fn expectCEqual32(u: @This()) !void {
            try testing.expectEqual(@as(u7, 32), u.b.c);
        }
    };

    var c: u7 = 32;
    try Union.expectCEqual32(.{ .b = .{ .c = c } });
}
$ zig test repro.zig -ODebug
All 1 tests passed.
$ zig test repro.zig -OReleaseSafe
Test [1/1] test.pass nested union with rls... expected 32, found 0
Test [1/1] test.pass nested union with rls... FAIL (TestExpectedEqual)
lib/std/testing.zig:88:17: 0x20dbd7 in test.pass nested union with rls (test)
                return error.TestExpectedEqual;
                ^
repro.zig:12:13: 0x20dbdf in test.pass nested union with rls (test)
repro.zig:17:5: 0x20dbe7 in test.pass nested union with rls (test)
0 passed; 0 skipped; 1 failed.
error: the following test command failed with exit code 1:
zig-cache/o/5553b48f14dbd00c1285a49dc1084c38/test

@Vexu Vexu added the backend-llvm The LLVM backend outputs an LLVM IR Module. label Nov 10, 2023
@Vexu Vexu modified the milestones: 0.13.0, 0.12.0 Nov 10, 2023
@jacobly0 jacobly0 marked this as a duplicate of #16392 Nov 10, 2023
@jacobly0 jacobly0 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2023
@jacobly0 jacobly0 removed this from the 0.12.0 milestone Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

3 participants