On Sun, May 30, 2021 at 11:30:25PM -0700, apinski--- via Gcc-patches wrote:
> +static bool
> +zero_sized_decl (const_tree decl)
> +{
> +  if (!decl)
> +    return true;
> +
> +  tree type = TREE_TYPE (decl);
> +  if (AGGREGATE_TYPE_P (type) && TYPE_SIZE (type)
> +      && integer_zerop (TYPE_SIZE (type)))

Shouldn't this be instead
  if (AGGREGATE_TYPE_P (type)
      && !TREE_ADDRESSABLE (type)
      && is_empty_type (type))
?
It shouldn't matter if the type has zero size (e.g. typically in C) or
non-zero size (typically in C++), but that returning it is a nop, no bits
need to be copied anywhere.

        Jakub

Reply via email to