https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121584

--- Comment #5 from Fei Gao <Fei.Gao2 at arm dot com> ---
(In reply to Harald van Dijk from comment #2)
> Standalone minimal test:
> 
>   #pragma GCC aarch64 "arm_sve.h"
>   void foo() {
>     svfloat32x2_t x;
>   }
> 
> Compile with gcc -march=armv9-a -ftrivial-auto-var-init=pattern:
> 
>   <source>: In function 'void foo()':
>   <source>:3:17: sorry, unimplemented: __builtin_clear_padding not supported
> for variable length aggregates
>       3 |   svfloat32x2_t x;
>         |                 ^
> 
> https://godbolt.org/z/rjzqedEKf

Thanks, Harald, for providing the test case!


(In reply to Andrew Pinski from comment #4)
> (In reply to Andrew Pinski from comment #3)
> > I might take a look this afternoon .
> 
> This works:
> ```
> diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
> index 35c457406dc..3913e3255b3 100644
> --- a/gcc/gimple-fold.cc
> +++ b/gcc/gimple-fold.cc
> @@ -4706,6 +4706,9 @@ clear_padding_bitint_needs_padding_p (tree type)
>  bool
>  clear_padding_type_may_have_padding_p (tree type)
>  {
> +  /* Assume poly sized types don't need padding.  */
> +  if (POLY_INT_CST_P (TYPE_SIZE_UNIT (type)))
> +    return false;
>    switch (TREE_CODE (type))
>      {
>      case RECORD_TYPE:
> 
> ```
> 
> I will do some more testing and submit a patch.

Thank you, Andrew, for taking a look!

Reply via email to