-
Notifications
You must be signed in to change notification settings - Fork 103
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
Lowering to LLVM fails for constant array of unions with unequal initializer types #1185
Comments
The previous use case was, we hope the type of array of struct with unions to be the same. However, it looks like the array of unions are an outliner. To be more clear, it is about array of initializers for unions (or containing unions). But now we can't express the type for unions (or for type containing unions) precisely, this is the intention of #1007 I am wondering if we can add an attribute to constStructAttr and add a "isTypeAttributesCompatible" method, then we can use it to compare the |
Indeed, looks like we need some extra information on the attributes for the sake of unions. |
Hello @ChuanqiXu9, @bcardosolopes any updates regarding this issue?) |
Sorry. Quite busy with other business. I'll try if I can find sometime next week to look into the details. Or if you have time, maybe you can try it with above suggestions. |
I would appreciate if you have the time next week since you have more knowledge about the issue, but I would also try with your suggestions. Thanks for the quick reply) |
I might be able to take a look next week but more likely next year, sorry! |
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.
Sent #1236 and see the comments there for details. |
In, #1166, is there a reason why setting
CommonElementType = nullptr
was removed when all the elements don't have the same type?For example, the following code snippet now fails when lowering to LLVM:
cc: @bcardosolopes, @ChuanqiXu9
The text was updated successfully, but these errors were encountered: