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

Complier & LLVM crash when initializing an any in global/static memory #4627

Open
blob1807 opened this issue Dec 25, 2024 · 0 comments
Open

Comments

@blob1807
Copy link
Contributor

blob1807 commented Dec 25, 2024

Context

Odin:    dev-2024-12:ad99d20d2
OS:      Windows 11 Home Basic (version: 23H2), build 22631.4602
CPU:     AMD Ryzen 7 6800HS with Radeon Graphics
RAM:     15608 MiB
Backend: LLVM 18.1.8

Issue was originally reported by juice.thekid on the Discord

Expected Behavior

No complier crashes

Current Behavior

Complier asserts with src\llvm_backend_general.cpp(995): Assertion Failure: are_types_identical(ca, core_type(value.type)) typeid != ^Type_Info when initializing a file scope global any with a value.

Type *ca = core_type(a);
if (ca->kind == Type_Basic) {
GB_ASSERT_MSG(are_types_identical(ca, core_type(value.type)), "%s != %s", type_to_string(a), type_to_string(value.type));
}

LLVM error with below when initializing a static any with a value.

LLVM Error:
Global variable initializer type does not match global variable type!
ptr @main.main-.a-36764

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Copy Paste
  2. Uncomment one a
  3. Run
  4. Profit???
  5. Repeat 2-4.
package main
import "core:fmt"

// global any - complier assertion
// a: any = 9

main :: proc() {
    // static any - llvm error
    // @static a: any = 9
    fmt.println(a)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant