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

Silent compiler crash when checking array of pointers to be equal to nil #4631

Open
4lbert opened this issue Dec 26, 2024 · 0 comments
Open

Comments

@4lbert
Copy link

4lbert commented Dec 26, 2024

Context

Odin:    dev-2024-12:ad99d20d2
OS:      Windows 11 Professional (version: 23H2), build 22631.4602
CPU:     AMD Ryzen 7 5700X 8-Core Processor
RAM:     16294 MiB
Backend: LLVM 18.1.8

Expected Behavior

Should give a compiler error message like this: Error: Cannot convert untyped value 'nil' to '[2]^int' from 'untyped nil'

Current Behavior

Compilation gives no error message and no binary is produced.

Failure Information

Checking an array to be equal to nil gives a compiler error as expected, but no error is given if the array holds pointers.

This works as expected:

a: [2]int
fmt.println(a == nil) // Error: Cannot convert untyped value 'nil' to '[2]int' from 'untyped nil'

but this silently crashes the compiler:

a: [2]^int
fmt.println(a == nil)

Steps to Reproduce

package main

import "core:fmt"

main :: proc() {
	a: [2]^int
	fmt.println(a == nil)
}

When running odin run . nothing gets printed.

Failure Logs

None

@4lbert 4lbert changed the title Silent compiler crash is checking array of pointers to be equal to nil Silent compiler crash when checking array of pointers to be equal to nil Dec 26, 2024
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