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
When you define a vector as a compile time constant, you can only access it's fields with compile time constants. That's not the case with matrices, you can access the fields of a compile time constant matrix with variables just fine. However, trying to access a globally defined matrix inside of a procedure, if it is not a constant value it gives a llvm compile error that is unreadable. However, if you just define the matrix locally to the procedure or pass it by argument, the error stops.
I don't know if this is intended or not, but definitely seems like this shouldn't happen. If otherwise this is intended, then I suggest working on the compile error.
Odin and OS Info
Odin: dev-2024-07:fc5ce30
OS: Windows 10 Professional (version: 22H2), build 19045.4651
CPU: AMD Ryzen 5 5500U with Radeon Graphics
RAM: 5989 MiB
Backend: LLVM 18.1.8
Expected Behavior
I should be able to use matrices defined as variables in the global scope with other variables as indexes without having to pass the matrix as an argument.
Current Behavior
If you define a matrix in the global scope that is being used inside of a procedure, then trying to access it's fields using variables gives compile errors.
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
Just run the following:
package main
m := matrix[3, 3]f32{
1, 0, 0,
0, 1, 0,
0, 0, 1,
}
main :: proc() {
row, col := 1, 2
_ = m[row, col]
}
Context
When you define a vector as a compile time constant, you can only access it's fields with compile time constants. That's not the case with matrices, you can access the fields of a compile time constant matrix with variables just fine. However, trying to access a globally defined matrix inside of a procedure, if it is not a constant value it gives a llvm compile error that is unreadable. However, if you just define the matrix locally to the procedure or pass it by argument, the error stops.
I don't know if this is intended or not, but definitely seems like this shouldn't happen. If otherwise this is intended, then I suggest working on the compile error.
Odin and OS Info
Odin: dev-2024-07:fc5ce30
OS: Windows 10 Professional (version: 22H2), build 19045.4651
CPU: AMD Ryzen 5 5500U with Radeon Graphics
RAM: 5989 MiB
Backend: LLVM 18.1.8
Expected Behavior
I should be able to use matrices defined as variables in the global scope with other variables as indexes without having to pass the matrix as an argument.
Current Behavior
If you define a matrix in the global scope that is being used inside of a procedure, then trying to access it's fields using variables gives compile errors.
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
Just run the following:
Failure Logs
Error:
The text was updated successfully, but these errors were encountered: