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

Compiler segfaults when nil checking [N]rawptr #4869

Open
pietrovismara opened this issue Feb 23, 2025 · 1 comment
Open

Compiler segfaults when nil checking [N]rawptr #4869

pietrovismara opened this issue Feb 23, 2025 · 1 comment

Comments

@pietrovismara
Copy link

pietrovismara commented Feb 23, 2025

Context

Odin: dev-2024-12:7be003557
OS: Windows 11 Professional (version: 23H2), build 22631.4890
CPU: 12th Gen Intel(R) Core(TM) i7-12700K
RAM: 32509 MiB
Backend: LLVM 18.1.8

Expected Behavior

I'd expect the compiler to fail with Cannot convert untyped value 'nil' to '[4]rawptr' from 'untyped nil'

Failure Information (for bugs)

This bug has also been confirmed to happen on dev-2025-02.

Steps to Reproduce

package main

import "core:fmt"

data := [4]rawptr{}

main :: proc() {
    fmt.printfln("main")
    if data != nil {
        fmt.printfln("%v", data)
    }
}
@FourteenBrush
Copy link
Contributor

FourteenBrush commented Feb 23, 2025

On dev-2025-02
This occurs on any array of types which nil can be assigned to (pointers, cstring, enums, bitsets, typeids and fn pointers)

Sys details:

        Odin:    dev-2025-02
        OS:      NixOS 25.05 (Warbler), Linux 6.6.71
        CPU:     AMD Ryzen 7 5800H with Radeon Graphics         
        RAM:     15847 MiB
        Backend: LLVM 18.1.8

gdb output of odin build main.odin -file:

Thread 1 ".odin-wrapped" received signal SIGSEGV, Segmentation fault.
0x00007fffefd8ece2 in LLVMIsConstant () from /nix/store/gkb76wz2dmx7x8d8xlf78gg1bxnf6l6m-llvm-18.1.8-lib/lib/libLLVM.so.18.1
(gdb) 

@pietrovismara pietrovismara changed the title Nil check on [N]rawptr compiles but crashes on launch Compiler segfaults when nil checking [N]rawptr Feb 23, 2025
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

2 participants