adams381 wrote:

@andykaylor The crash was happening because the field and its initializer 
disagreed on the type of the zero-width bit-field.  The field lowers to `[0 x 
i8]`, dropping the declared type so LLVM does not apply its alignment and grow 
the record, while the initializer element keeps `[0 x i32]`.  Building the 
record as a chain of `insertvalue` then puts a `[0 x i32]` into a `[0 x i8]` 
field, and the verifier rejects it.  That chain is only used when the 
initializer cannot fold to bytes, which is why it takes a relocatable or a 
`_BitInt` to reach.

The visitor now writes a zero of the field's own type instead, so you get `[0 x 
i8] zeroinitializer`.  The same fix covers it in an array element, a nested 
record, and a local.  A flexible array member lowers to a zero-length field 
too, but its type matches, so it is left alone.

https://github.com/llvm/llvm-project/pull/217517
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to