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

[CIR] Remove InavalidUnionFieldAttr and remove a check in array attr #1166

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

ChuanqiXu9
Copy link
Member

Close #1131

This is another solution to #1160

This patch revert #1007 and remain its test. The problem described in #1007 is workaround by skipping the check of equivalent of element types in arrays.

We can't mock such checks simply by adding another attribute to ConstStructAttr since the types are aggregated. e.g., we have to handle the cases like struct { union { ... } } and struct { struct { union { ... } } } and so on. To make it, we have to introduce what I called "two type systems" in #1160.

This is not very good giving it removes a reasonable check. But it might not be so problematic since the Sema part has already checked it. (Of course, we still need face the risks to introduce new bugs any way)

@bcardosolopes bcardosolopes merged commit c04a964 into llvm:main Nov 27, 2024
6 checks passed
@@ -328,7 +328,8 @@ cir.func @cast27(%p : !u64i) {
!u32i = !cir.int<u, 32>
!u8i = !cir.int<u, 8>
module {
// expected-error@+1 {{constant array element should match array element type}}
// FIXME: The check for equality of the array element type is currently disabled due to https://github.com/llvm/clangir/pull/1007
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's file an issue for this

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.

Union Initializer Fails During CIRGen
2 participants