Describe the bug
Compile time arrays are built by _vinit in wrong order resulting in initialisation failure
Reproduction Steps
Compile and run this code:
const array1 = [1]
const array2 = [array1]
const array3 = array2[0]
fn main() {
assert array3 == array1
}
Expected Behavior
I expect it to run
Current Behavior
_vinit builds the arrays in this order: array1, array3, array2
but array3 is dependent on array2 which causes an out of bounds error
Possible Solution
None found
Additional Information/Context
No response
V version
V 0.4.11 52ae3f
Environment details (OS name and version, etc.)
v doctor
|V full version |V 0.4.11 52ae3f2476b70e5590846b176fb176fe1475d13b
|:-------------------|:-------------------
|OS |linux, "EndeavourOS Linux"
|Processor |16 cpus, 64bit, little endian, AMD Ryzen 7 5800H with Radeon Graphics
|Memory |1.19GB/30.74GB
| |
|V executable |/home/dave/v/v
|V last modified time|2025-07-05 14:19:25
| |
|V home dir |OK, value: /home/dave/v
|VMODULES |OK, value: /home/dave/.vmodules
|VTMP |OK, value: /tmp/v_1000
|Current working dir |OK, value: /home/dave/precious/fellsafe/v
| |
|Git version |git version 2.50.0
|V git status |weekly.2025.16-398-g52ae3f24
|.git/config present |true
| |
|cc version |cc (GCC) 15.1.1 20250425
|gcc version |gcc (GCC) 15.1.1 20250425
|clang version |clang version 20.1.7
|tcc version |tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
|tcc git status |thirdparty-linux-amd64 696c1d84
|emcc version |N/A
|glibc version |ldd (GNU libc) 2.41
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
Describe the bug
Compile time arrays are built by _vinit in wrong order resulting in initialisation failure
Reproduction Steps
Compile and run this code:
Expected Behavior
I expect it to run
Current Behavior
_vinit builds the arrays in this order: array1, array3, array2
but array3 is dependent on array2 which causes an out of bounds error
Possible Solution
None found
Additional Information/Context
No response
V version
V 0.4.11 52ae3f
Environment details (OS name and version, etc.)
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.