-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
cgen: array assertion fails on MacBook Pro M2 #24529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Bug
This tag is applied to issues which reports bugs.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Comments
Connected to Huly®: V_0.6-22897 |
It only fails on test files. For example: // v run app.v OK!
fn foo(i int) !int {
m := [3, 4, 5]
return m[i]!
}
fn main() {
g := foo(3) or { 12 }
assert g == 12
} // v app_test.v
//
// Output
// app_test.v:9: fn test_main
// > assert g == 12
// Left value (len: 8): `14917584` (random value)
// Right value (len: 2): `12`
fn foo(i int) !int {
m := [3, 4, 5]
return m[i]!
}
fn test_main() {
g := foo(3) or { 12 }
assert g == 12
} |
Probably the problem is here: https://github.com/vlang/v/blob/master/vlib/v/gen/c/cgen.v#L7090 // maybe sizeof is incorrect
g.writeln2('\t${styp} ${err_obj};', '\tmemcpy(&${err_obj}, &${cvar_name}, sizeof(${result_name}));') According to ChatGPT:
|
Can you try PR #24564 ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Bug
This tag is applied to issues which reports bugs.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
The following code does not terminate properly on an MacBook Pro M2 (and M1 too):
Test the file:
v test main_test.v
See the output:
Reproduction Steps
Buy a Macbook Pro or ask a friend who already has one for a favor and run the code above.
Expected Behavior
It should complain.
Current Behavior
It doesn't complain.
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.10 6be298d
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: