V version: V 0.4.9 2a69b7c , press to see full `v doctor` output
V full version
V 0.4.9 f048bb3.2a69b7c
OS
linux, "EndeavourOS Linux"
Processor
16 cpus, 64bit, little endian, AMD Ryzen 7 8845HS w/ Radeon 780M Graphics
Memory
19.6GB/30.64GB
V executable
/home/lmp/Projects/v/v
V last modified time
2025-01-21 08:39:50
V home dir
OK, value: /home/lmp/Projects/v
VMODULES
OK, value: /home/lmp/.vmodules
VTMP
OK, value: /dev/shm
Current working dir
OK, value: /home/lmp/Projects/v
Git version
git version 2.48.1
V git status
weekly.2025.03-19-g2a69b7c5 (2 commit(s) behind V master)
.git/config present
true
cc version
cc (GCC) 14.2.1 20240910
gcc version
gcc (GCC) 14.2.1 20240910
clang version
clang version 19.1.7
tcc version
tcc version 0.9.28rc 2024-07-31 HEAD@1cee0908 (x86_64 Linux)
tcc git status
thirdparty-linux-amd64 0134e9b9
emcc version
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.72-git (437140d149d9c977ffc8b09dbaf9b0f5a02db190)
glibc version
ldd (GNU libc) 2.40
What did you do?
./v -g -o vdbg cmd/v && ./vdbg t.v && t
module main
import math.vec
pub struct Bezier {
pub mut :
points [4 ]vec.Vec2 [f32 ]
}
pub fn (b Bezier) h3 () vec.Vec2 [f32 ] {
return b.points[2 ]
}
pub fn (b Bezier) h4 () vec.Vec2 [f32 ] {
return b.points[3 ]
}
pub fn (b Bezier) end () vec.Vec2 [f32 ] {
return b.h4 ()
}
pub struct Path {
pub mut :
segments [1024 ]Bezier
len int // should be read-only
}
pub fn (mut p Path) add (b Bezier) {
assert p.len + 1 < 1024
p.segments[p.len] = b
p.len++
}
fn main () {
b1 := Bezier{
points: [vec.Vec2 [f32 ]{100 , 100 }, vec.Vec2 [f32 ]{120 , 80 },
vec.Vec2 [f32 ]{200 , 70 }, vec.Vec2 [f32 ]{400 , 200 }]!
}
b2 := Bezier{
points: [b1 .end (), b1 .h3 () + vec.Vec2 [f32 ]{0 , 2 * 80 }, vec.Vec2 [f32 ]{200 , 70 },
b1 .end () + vec.Vec2 [f32 ]{400 , 200 }]!
}
mut path := Path{}
path.add (b1 )
path.add (b2 )
println (sizeof (path))
}
What did you see?
================== C compilation error (from tcc): ==============
cc: /dev/shm/t.01JJ4PA9HFFVSK3Y4YDY0MWBMP.tmp.c:7745: error: cannot convert 'struct math__vec__Vec2_T_f32' to 'void *'
=================================================================
(You can pass `-cg`, or `-show-c-output` as well, to print all the C error messages).
builder error:
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, please report it using `v bug file.v`,
or goto https://github.com/vlang/v/issues/new/choose .
You can also use #help on Discord: https://discord.gg/vlang .
What did you expect to see?
Something like "32772"
Workaround
module main
import math.vec
pub struct Bezier {
pub mut :
points [4 ]vec.Vec2 [f32 ]
}
pub fn (b Bezier) h3 () vec.Vec2 [f32 ] {
return b.points[2 ]
}
pub fn (b Bezier) h4 () vec.Vec2 [f32 ] {
return b.points[3 ]
}
pub fn (b Bezier) end () vec.Vec2 [f32 ] {
return b.h4 ()
}
pub struct Path {
pub mut :
segments [1024 ]Bezier
len int // should be read-only
}
pub fn (mut p Path) add (b Bezier) {
assert p.len + 1 < 1024
p.segments[p.len] = b
p.len++
}
fn main () {
p_b1 := [vec.Vec2 [f32 ]{100 , 100 }, vec.Vec2 [f32 ]{120 , 80 }, vec.Vec2 [f32 ]{200 , 70 }, vec.Vec2 [f32 ]{400 , 200 }]!
b1 := Bezier{
points: p_b1
}
p_b2 := [b1 .end (), b1 .h3 () + vec.Vec2 [f32 ]{0 , 2 * 80 }, vec.Vec2 [f32 ]{200 , 70 }, b1 .end () + vec.Vec2 [f32 ]{400 , 200 }]!
b2 := Bezier{
points: p_b2
}
mut path := Path{}
path.add (b1 )
path.add (b2 )
println (sizeof (path))
}
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.
V version: V 0.4.9 2a69b7c, press to see full `v doctor` output
What did you do?
./v -g -o vdbg cmd/v && ./vdbg t.v && tWhat did you see?
What did you expect to see?
Something like "32772"
Workaround
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.