Skip to content
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

Reinstate #1007 equality of array types #1178

Open
bcardosolopes opened this issue Nov 27, 2024 · 2 comments
Open

Reinstate #1007 equality of array types #1178

bcardosolopes opened this issue Nov 27, 2024 · 2 comments

Comments

@bcardosolopes
Copy link
Member

Originally posted by @bcardosolopes in #1166 (comment)

@bcardosolopes
Copy link
Member Author

cc @ChuanqiXu9

@ChuanqiXu9
Copy link
Member

Some detailed description:

In #1166, we disabled to check for the equality of array element types for the following issue:

In an array of unions (or types containing unions), we may construct an array attribute from the initializers. However, the type of the initializers may be different for unions. #1007 is another try to solve the problem but it shows it is not easy to fix it fundamentally without introducing two type systems: one for code gen for CIR and one for lowering CIR. See the comments in #1160 (comment) for detailed analysis.

ChuanqiXu9 added a commit to ChuanqiXu9/clangir that referenced this issue Dec 16, 2024
Close llvm#1185

The patch itself seems slightly ad-hoc. As the issue tracked by
llvm#1178, the fundamental solution
may be to introduce two type systems to solve the inconsistent semantics
for Union between LLVM IR and CIR. This will be great to handle other
inconsistent semantics between LLVM IR and CIR if any.

Back to the patch itself, although the code looks not good initially to
me too. But I feel it may be a good workaround since
clang/test/CIR/Lowering/union-array.c is an example for array of unions
directly and clang/test/CIR/Lowering/nested-union-array.c gives an
example for array of unions indirectly (array of structs which contain
unions). So I feel we've already covered all the cases.

And generally it should be good to use some simple and solid workaround
before we introduce the formal full solution.
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

No branches or pull requests

2 participants