_vcleanup crashes when importing time
with -autofree
#21212
Labels
Bug
This tag is applied to issues which reports bugs.
OS: Windows
Bugs/feature requests, that are specific to Windows OS.
Describe the bug
When importing
time
and compiling with-autofree
, ifmain
returns, then during_vcleanup
the program tries to callarray_free
on_const_time__long_days
, which is a fixed sized array. This is an instance of #21211 but could be worked around in the mean time.Reproduction Steps
run with
v -autofree run time_autofree_bug.v
Expected Behavior
I expect it to print the current time and then exit cleanly.
Current Behavior
It prints the current time, and then crashes.
Possible Solution
_const_time__long_days is a
Array_fixed_string_7
, i.e. a[7]string
, not a[]string
, and so cgen shouldn't be callingarray_free
on it.Its definition is here:
https://github.com/vlang/v/blob/master/vlib/time/time.v#L4
Looking at
long_months
in the same file,long_months
is not declared with[]!
, possibly as a workaround to this same bug. In the short term makinglong_days
not fixed-size would work around this problem, but fixing the actual bug itself: #21211 would solve it properly.Additional Information/Context
Running on Windows with
msvc
.V version
V 0.4.5 ad17be5
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.
The text was updated successfully, but these errors were encountered: