Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Panic with unused `~uint`

Open Feoramund opened this issue 1 year ago • 0 comments

Context

While looking into #3463, I noticed I could cause an unrelated panic by bitwise-notting an integer type.

NOT FOUND lb_type_info_index:
	uint
	@ index 78
	max count: 0
Found:
src/llvm_backend_type.cpp(17): Panic: NOT FOUND
package main

import "core:fmt"

main :: proc() {
    j := ~uint
    // fmt.printfln("%0X", j)
}

Strangely, the panic does not occur if I print the value, which ends up being FEFFFFFFFFFFFFFE. I would've expected all the bits to be set, as with ~uint(0), or for an error message along the lines of "this is a type, not an expression."

Odin:    dev-2024-05:2250eb3e7
OS:      Arch Linux, Linux 6.8.9-arch1-1
CPU:     12th Gen Intel(R) Core(TM) i7-12700K
RAM:     31916 MiB
Backend: LLVM 17.0.6

Feoramund avatar May 10 '24 23:05 Feoramund