Skip to content

Conversation

Rokannon
Copy link

@Rokannon Rokannon commented May 30, 2025

Fixes ziglang/translate-c#50.

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.

@alexrp
Copy link
Member

alexrp commented Sep 29, 2025

Closing since we've switched to Aro-based translate-c as of #24497. Contributions to translate-c should now be opened on https://github.com/ziglang/translate-c.

@alexrp alexrp closed this Sep 29, 2025
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

2 participants