Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.67k
stars
2.15k
forks
source link
Runtime error when print struct with uninitialized field of interface type #18718
interface Some {}
struct Foo {
name Some
}
a := Foo{}
println(a)
Expected Behavior
No runtime error
Current Behavior
Output:
/tmp/v_60000/code.17284851134424006581.tmp.c:2180: at indent_main__Some_str: RUNTIME ERROR: invalid memory access
/tmp/v_60000/code.17284851134424006581.tmp.c:2167: by indent_main__Foo_str
/tmp/v_60000/code.17284851134424006581.tmp.c:2158: by main__Foo_str
/tmp/v_60000/../../../../../../box/code.v:8: by main__main
/tmp/v_60000/../../../../../../tmp/v_60000/code.17284851134424006581.tmp.c:17332: by main
Exited with error status 255
Reproduction Steps
Run code above
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.3.4 fc4c431.45f16a2
Environment details (OS name and version, etc.)
V full version: V 0.3.5 fc4c431.015ccc2
OS: linux, Ubuntu 22.04.2 LTS
Processor: 2 cpus, 64bit, little endian, Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
getwd: /home/pmakhnev/playground
vexe: /home/pmakhnev/v/v
vexe mtime: 2023-06-30 00:00:09
vroot: OK, value: /home/pmakhnev/v
VMODULES: OK, value: /root/.vmodules
VTMP: OK, value: /tmp/v_0
Git version: git version 2.34.1
Git vroot status: weekly.2023.26-31-g015ccc2a
.git/config present: true
CC version: cc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
Describe the bug
Code: https://vosca.dev/p/8cba48032c
Expected Behavior
No runtime error
Current Behavior
Output:
Reproduction Steps
Run code above
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.3.4 fc4c431.45f16a2
Environment details (OS name and version, etc.)