-
-
Notifications
You must be signed in to change notification settings - Fork 908
Open
Description
Context
- Operating System & Odin Version: Arch Linux, Odin
dev-2026-02:b942f72(also reproduced ondev-2026-03master build) - Please paste
odin reportoutput:
Useful information to add to a bug report:
Odin: dev-2026-02:b942f72
OS: Arch Linux, Linux 6.18.9-arch1-2
CPU: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
RAM: 15771 MiB
Backend: LLVM 21.1.8
Expected Behavior
Unary-negated compound literals should behave consistently in initializers.
For this code, bad.v should be [-1, -5].
Current Behavior
When unary-negating a compound literal inside a struct literal field initializer, value initializes incorrectly to [0, 0].
-Vec2{1, 5} works in a direct assignment, and Vec2{-1, -5} works in struct literal fields, but Pair{v = -Vec2{1, 5}} is wrong.
Failure Information
Steps to Reproduce
- Create
repro.odin:
package main
import "core:fmt"
Vec2 :: [2]f32
Pair :: struct { v: Vec2 }
main :: proc() {
ok1 := -Vec2{1, 5}
ok2 := Pair{v = Vec2{-1, -5}}
// Repro line:
bad := Pair{v = -Vec2{1, 5}}
fmt.println("ok1:", ok1)
fmt.println("ok2:", ok2.v)
fmt.println("bad:", bad.v)
}- Run:
odin run repro.odin -file- Observe output.
Failure Logs
Actual output on affected versions (dev-2026-02, dev-2026-03 tested):
ok1: [-1, -5]
ok2: [-1, -5]
bad: [0, 0]
Expected:
ok1: [-1, -5]
ok2: [-1, -5]
bad: [-1, -5]
Bisect result (caveated):
- First bad commit found by bisect for this repro:
8be18d9a401f898320b57379488bad1367632628 - Commit message:
Allow for constant []typeid - Parent (
35a32d41e) produced good output; first bad commit produced bad output. - Bisect/build in that older range used
LLVM_CONFIG=llvm-config-20to make historical tags buildable on this machine.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels