Michael Chang wrote in patch 2/2:
> ../../grub-core/fs/zfs/zfs.c:2263:44: error: array subscript '<unknown>' is
> outside the bounds of an interior zero-length array 'grub_uint16_t[0]' {aka
> 'short unsigned int[0]'} [-Werror=zero-length-bounds]
> [...]
> The l_hash[0] is apparnetly an interior member to the enclosed structure
> [...] the l_entries[0] is used to get proper alignment to access leaf chunks

That's what i call a dirty hack.

I wonder what gcc would say to a union of [0]-sized arrays as last
member of the struct type:

  struct typedef struct zap_leaf_phys {
        union {
                grub_uint16_t l_hash[0];
                grub_properly_aligned_t l_entries[0];
        } l_;
  } zap_leaf_phys_t;

Mine likes such a gesture, but it is way behind in respect to modern bitrot.

So in the end, your patch looks like the solid and unambiguous way to
implement what is desired.

> It would be great if you can help to test patch to solve the build
> problem for gcc-10 in your system or not.

Due to lack of modernity i can only contribute statements that the
concepts and motivations of your two patches look good to me.

(I also lack the occasion to test the two use cases.
 Just lurking here for grub-mkrescue issues, where i provide the last stage
 of packing up the ISO image.)

Have a nice day :)


Grub-devel mailing list

Reply via email to