You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package test
import"core:fmt"
main :: proc() {
@(rodata, static)
data := [][]f64{{1, 2, 3, 4}, {5, 6, 7, 8, 9, 10}}
fmt.println(data[0][0]) // 1
data[0][0] = 42// will compile, but NOT crash at runtime
fmt.println(data[0][0]) // 42
}
Issue: when declaring an @(rodata, static) slice literal the fixed array backing is still considered mutable by the compiler but does NOT crash at runtime
Desired
Compiler should error (if possible) when trying to mutate a slice literal but should at least crash at runtime if compiler passes it
compiler command
odin run . or odin build .
system info
Odin 2025-01
Windows
LLVM 18.1.8
suggested labels
?
The text was updated successfully, but these errors were encountered:
speechfreedoms
changed the title
When declaring an @(rodata) slice literal the fixed array backing is still mutable
When declaring an @(rodata, static) slice literal the fixed array backing is still mutable (compiles) but does not crash
Feb 6, 2025
speechfreedoms
changed the title
When declaring an @(rodata, static) slice literal the fixed array backing is still mutable (compiles) but does not crash
When declaring an @(rodata, static) slice literal the fixed array backing is still mutable (compiles) but does not crash (which is desired)
Feb 6, 2025
minimal example
Issue: when declaring an @(rodata, static) slice literal the fixed array backing is still considered mutable by the compiler but does NOT crash at runtime
Desired
Compiler should error (if possible) when trying to mutate a slice literal but should at least crash at runtime if compiler passes it
compiler command
odin run . or odin build .
system info
Odin 2025-01
Windows
LLVM 18.1.8
suggested labels
?
The text was updated successfully, but these errors were encountered: