Skip to content

cgen: fix initialize error object in or_block (fix #24529)#24576

Merged
spytheman merged 1 commit into
vlang:masterfrom
gchumillas:fix_array_assertion_fails_on_mackbook_pro
May 29, 2025
Merged

cgen: fix initialize error object in or_block (fix #24529)#24576
spytheman merged 1 commit into
vlang:masterfrom
gchumillas:fix_array_assertion_fails_on_mackbook_pro

Conversation

@gchumillas

@gchumillas gchumillas commented May 25, 2025

Copy link
Copy Markdown
Contributor

Fixes #24529

There's no guarantee that memcpy will work correctly, since err_obj and cvar_name can be of different types. Instead of using memcpy, we declare a fresh variable and initialize its values.

All tests passed on a MacBook Pro M1:

v self
v test-self

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-22941

@gchumillas gchumillas changed the title fix: initialize error object in or_block (fix #24529) cgen: fix initialize error object in or_block (fix #24529) May 26, 2025
@spytheman

Copy link
Copy Markdown
Contributor

Excellent. Thanks for the fix.

Please also add the failing test from the issue #24529 in vlib/v/tests/, to prevent regressions for similar cases in the future.

@gchumillas

Copy link
Copy Markdown
Contributor Author

@spytheman the failing test described in the bug was already included here:
https://github.com/vlang/v/blob/master/vlib/v/tests/builtin_arrays/array_map_or_test.v#L115

It is exactly the same test :)

@spytheman

spytheman commented May 29, 2025

Copy link
Copy Markdown
Contributor

i.e. the difference between you, where the test failed before, and the CI, is only in the version of the OS/compiler?

@spytheman spytheman merged commit 2432286 into vlang:master May 29, 2025
74 checks passed
@gchumillas

Copy link
Copy Markdown
Contributor Author

Yes, that's right. The tests failed on a MacBook Pro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cgen: array assertion fails on MacBook Pro M2

3 participants