Bug #1:
package repro
import "core:fmt"
main :: proc() {
Render_Options :: struct {
color0: [4]f32,
color1: Maybe([4]f32),
}
Button_Options :: struct {
using render: Render_Options,
}
bo0 := Button_Options{color0 = [4]f32{1, 0, 1, 1}, color1 = [4]f32{0, 0, 1, 1}}
fmt.println(bo0) // prints: Button_Options{render = Render_Options{color0 = [1, 0, 1, 1], color1 = nil}}
// if we explicitly set the values via 'render', then it works
bo1 := Button_Options{render = {color0 = [4]f32{1, 0, 1, 1}, color1 = [4]f32{0, 0, 1, 1}}}
fmt.println(bo1) // prints: Button_Options{render = Render_Options{color0 = [1, 0, 1, 1], color1 = [0, 0, 1, 1]}}
}
Bug #2 (core:fmt bug? or bad codegen?):
package repro
import "core:fmt"
main :: proc() {
Render_Options :: struct {
color0: [4]f32,
color1: union{[4]f32, int}, // NOTE: now a union of two types
}
Button_Options :: struct {
using render: Render_Options,
}
ro0 := Render_Options{color0 = [4]f32{1, 0, 1, 1}, color1 = [4]f32{0, 0, 1, 1}}
fmt.println(ro0) // this is fine
// bo0 := Button_Options{render = {color0 = [4]f32{1, 0, 1, 1}, color1 = [4]f32{0, 0, 1, 1}}}
// fmt.println(bo0)
// ^^^^ If this is uncommented, then the assertion from printing bo1 doesn't happen!
// ^^^^ If this is uncommented, but we didn't assign values via 'render = ' then the crash still happens
bo1 := Button_Options{color0 = [4]f32{1, 0, 1, 1}, color1 = [4]f32{0, 0, 1, 1}}
fmt.println(bo1) // Triggers assertion: core/fmt/fmt.odin(2764:23) Index 140720308486143 is out of range 0..<2
// OR sometimes: core/fmt/fmt.odin|2754 col 2 r| tag >= 0
}
PS: Actually, bug #2 looks like some kind of UB, but I will leave my ‘guesses’ intact.
PSS: ah, I see #1 was already reported: Issue · GitHub.
Odin version: dev-2026-06:4ad085b30 (this is ‘origin master’ at the time of writing this post, but this happened on older version as well)