Skip to content

Fix temporary variable naming collision when using translate-c with __builtin_convertvector. #24029

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Rokannon
Copy link

@Rokannon Rokannon commented May 30, 2025

Fixes #23999.

The root cause of this issue was that the expression passed into the __builtin_convertvector upon translation into zig code was evaluated for every component of vector. This means that if expression itself uses temporary variables, then they could conflict with the ones used in the implementation of __builtin_convertvector.

In this change we introduce a temporary variable which now holds the expression. Also a test was added to excercise this behavior and ensure that no collisions occur in the previously faulty scenario.

@Rokannon Rokannon changed the title Fix temporary variable naming collision when using translate-c with __builtin_convertvector. Fix temporary variable naming collision when using translate-c with __builtin_convertvector. May 30, 2025
@Rokannon
Copy link
Author

One check has failed with the following error:

error: sub-compilation of libzigc failed
    note: LLVM failed to parse 'x86_64-unknown-linux5.10.0-musl': No available targets are compatible with triple "x86_64-unknown-linux5.10.0-musl"
error: sub-compilation of compiler_rt failed
    note: LLVM failed to parse 'x86_64-unknown-linux5.10.0-musl': No available targets are compatible with triple "x86_64-unknown-linux5.10.0-musl"

I don't think it is releated to the change done in this pull request. I can see the same failure in some other PRs.

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.

Local variables naming collision when using translate-c with __builtin_convertvector
1 participant