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
❯ v -autofree run main.v
a
free(): invalid pointer
0x7fb6a0c550db: at ???: RUNTIME ERROR: abort() called
gdb output:
a
free(): invalid pointer
Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at pthread_kill.c:44
44 return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
(gdb) bt
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at pthread_kill.c:44
#1 __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:89
#2 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at pthread_kill.c:100
#3 0x00007ffff7d787c8 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007ffff7d5960d in __GI_abort () at abort.c:77
#5 0x00007ffff7d5a8c0 in __libc_message_impl (fmt=fmt@entry=0x7ffff7f0cd63 "%s\n")
at ../sysdeps/posix/libc_fatal.c:138
#6 0x00007ffff7de8ca7 in malloc_printerr (str=<optimized out>) at malloc.c:5892
#7 0x00007ffff7de8cc1 in malloc_printerr_tail (str=<optimized out>) at malloc.c:5909
#8 0x000000000060b589 in _v_free () at /tmp/v_1000/main.tmp.c:4030
#9 0x0000000000610615 in string_free () at /tmp/v_1000/main.tmp.c:5378
#10 0x0000000000614262 in main__main () at /tmp/v_1000/main.tmp.c:6148
#11 0x000000000061449b in main () at /tmp/v_1000/main.tmp.c:6184
main function:
VV_LOC void main__main(void) {
byteptr b = ((byteptr)("a"));
string s = byteptr_vstring(b);
println(s);
string_free(&s); // autofreed var main false
}
Describe the bug
See below snippet. Runs fine without autofree.
Reproduction Steps
Run with
v run test.vand note normal exit, run withv -autofree run test.vand note abort:Expected Behavior
Should exit normally as with the gc.
Current Behavior
gdb output:
main function:
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.11 487feb9
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.