Michael137 wrote:

> If I'm understanding correctly, the way this currently works is that you do 
> normal field layout, then if you discover that the actual offset of a field 
> is less than the offset normal field layout would produce, you assume the 
> struct is packed. This misses cases where a struct is packed, but the packing 
> doesn't affect the offset of any of the fields. But as you note, this can't 
> be fixed without adjusting the overall architecture.
> 
> There's an issue with the current implementation: it skips fields which 
> actually are packed, I think. Consider the following:
> 
> ```
> struct Empty {};
> struct __attribute((packed)) S {
>   [[no_unique_address]] Empty a,b,c,d;
>   char x;
>   int y;
> };
> S s;
> ```
> 
> In this case, the field "y" is both overlapping, and at a packed offset. 
> Really, you don't want to check for overlap; you want to ignore empty fields. 
> (Non-empty fields can't overlap.)

Updated the patch to ignore empty fields instead of checking overlap with 
previous fields.

https://github.com/llvm/llvm-project/pull/97443
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to