Odin icon indicating copy to clipboard operation
Odin copied to clipboard

LLVM backend assertion fails with global pointer struct literal with union inside

Open EeroMutka opened this issue 3 years ago • 1 comments

the compiler crashes with the following program:

package main
import "core:fmt"

Foo :: struct { x: int }
Bar :: struct { x: int }

Baz :: struct {
	variant: union { Foo, Bar },
}

global := &Baz{Foo{2}}

main :: proc() {
	fmt.println("foo", global)
}

output:

c:\dev\odin\src\llvm_backend_general.cpp(2466): Assertion Failure: `LLVMIsConstant(value.value)`    = load main.Baz, main.Baz* , align 8

Odin: dev-2021-12:db42a2db OS: Windows 10 Professional (version: 21H1), build 19043.1348 CPU: Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz RAM: 16303 MiB

EeroMutka avatar Dec 06 '21 10:12 EeroMutka

Hello!

I am marking this issue as stale as it has not received any engagement from the community or maintainers 120 days. That does not imply that the issue has no merit! If you feel strongly about this issue

  • open a PR referencing and resolving the issue;
  • leave a comment on it and discuss ideas how you could contribute towards resolving it;
  • leave a comment and describe in detail why this issue is critical for your use case;
  • open a new issue with updated details and a plan on resolving the issue.

The motivation for this automation is to help prioritize issues in the backlog and not ignore, reject, or belittle anyone..

github-actions[bot] avatar Jul 24 '22 22:07 github-actions[bot]