Skip to content

transform: fix bug in interface lowering when signatures are renamed #1768

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

Merged
merged 1 commit into from
Apr 5, 2021

Conversation

aykevl
Copy link
Member

@aykevl aykevl commented Apr 4, 2021

In rare cases the signature might change as a result of LLVM renaming
some named struct types when multiple LLVM modules are merged. The
easiest workaround is to detect such mismatched signatures and adding a
bitcast: this should be safe as the underlying data is effectively of
the same type.

This should fix #1765.

Note that this doesn't have tests as I don't really know the exact behavior of LLVM module merging and I have no idea what a good test would look like. Additionally, I intend to refactor this code in the future in a way that might avoid this issue entirely.

In rare cases the signature might change as a result of LLVM renaming
some named struct types when multiple LLVM modules are merged. The
easiest workaround is to detect such mismatched signatures and adding a
bitcast: this should be safe as the underlying data is effectively of
the same type.
@deadprogram
Copy link
Member

Confirmed that I can now build that program with this PR. Thanks for the quick fix @aykevl now merging.

@deadprogram deadprogram merged commit 99a41be into dev Apr 5, 2021
@deadprogram deadprogram deleted the fix-interface-lowering-signature-mismatch branch April 5, 2021 09:44
aykevl added a commit that referenced this pull request May 20, 2021
This fix is very similar to
#1768, but now for the return
type. It fixes the issue in
#1887.

Like #1768, I'm not sure how to test this as it is very specific to
certain renames that LLVM does and that don't seem very reproducable.
dgryski pushed a commit to dgryski/tinygo that referenced this pull request Oct 21, 2021
This fix is very similar to
tinygo-org#1768, but now for the return
type. It fixes the issue in
tinygo-org#1887.

Like tinygo-org#1768, I'm not sure how to test this as it is very specific to
certain renames that LLVM does and that don't seem very reproducable.
deadprogram pushed a commit that referenced this pull request Oct 28, 2021
This fix is very similar to
#1768, but now for the return
type. It fixes the issue in
#1887.

Like #1768, I'm not sure how to test this as it is very specific to
certain renames that LLVM does and that don't seem very reproducable.
ardnew pushed a commit to ardnew/tinygo that referenced this pull request Jun 21, 2022
This fix is very similar to
tinygo-org#1768, but now for the return
type. It fixes the issue in
tinygo-org#1887.

Like tinygo-org#1768, I'm not sure how to test this as it is very specific to
certain renames that LLVM does and that don't seem very reproducable.
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.

2 participants