NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.44k stars 12.93k forks source link

The Odin compiler is broken #322444

Open a3ru opened 5 days ago

a3ru commented 5 days ago

Describe the bug

odin version dev-2024-06 is broken

Steps To Reproduce

Node :: struct{
    token:Token,
    using _: bit_field u32 {
        kind:NodeKind | 8,
        subNodes: u32 | 24, // Second child ID
    },
}

results in a panic

src/check_expr.cpp(8856): Panic: invalid type: bit_field u32 {kind: NodeKind | 8, subNodes: u32 | 24 }
./build.sh: line 19: 97644 Illegal instruction     (core dumped) $ODIN build assembler $ODIN_FLAGS -out=$OUT/$EXE

Expected behavior

A clear and concise description of what you expected to happen.

Notify maintainers

@A1029384756

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.35, NixOS, 24.11 (Vicuna), 24.11.20240622.a71e967`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `"nixos"`
 - channels(ariel): `"nixos-23.11"`
 - nixpkgs: `/nix/store/yqy82fn77fy3rv7lpwa9m11w3a2nnqg5-source

Add a :+1: reaction to issues you find important.

a3ru commented 5 days ago

I compiled it from scratch using the shell.nix from the odin repo and it works

A1029384756 commented 5 days ago

@miragearhitect are there more reproduction steps that you can give? i created a minimal flake.nix and main.odin that pulled in the latest version of Odin, and ran the same code you did (albeit with Token defined as an empty struct and NodeKind as a u32) and was unable to reproduce on either x86_64-linux or aarch64-darwin

a3ru commented 5 days ago

compiling this with ./build.sh crashes but using a self compiled Odin it works

Problem Code

A1029384756 commented 5 days ago

did some investigation, this is not tied to the recent LLVM version update (tested on 17 - what the nix-shell is using and 13 - what was used previously) or the release build, going to require some additional digging into the rest of the package

a3ru commented 5 days ago

Yes, it was tested by some guys from the Odin discord and llvm version wasn't the problem. For them my code worked

A1029384756 commented 5 days ago

this is an issue with the tagged release for Odin, rebuilt with that version checked out instead of master and was able to repro but was unable to repro on master

a3ru commented 5 days ago

yup, compiling master is what fixed the problem

A1029384756 commented 5 days ago

will wait for an tagged release before updating nixpkgs to make sure that the version is "semi-official" (i.e. dev-2024-06a) and causes no other unknown breaking changes, in the meantime, you can just pull in default.nix for Odin and run callPackage with the current working commit as your ref