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

--- Comment #7 from qinzhao at gcc dot gnu.org ---
(In reply to Peter Bergner from comment #3)
> (In reply to Andrew Pinski from comment #1)
> > The types are OPAQUE_TYPE.
> [snip]
> > So if I understand this correctly and PR 98872 correctly. We should not
> > expand a DEFERRED_INIT for this type.
> 
> So something like this?  Ie, it's ok to just skip this altogether?  It does
> fix this particular ICE.

not sure whether this is too conservative or not.
if a OPAQUE_TYPE variable is in memory, we might be able to initialize it with
memset. 
however, when it is in register, we might need to skip the initialization. 
> 
> 
> diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
> index 9e10da0ad5c..200d14337d7 100644
> --- a/gcc/internal-fn.c
> +++ b/gcc/internal-fn.c
> @@ -3041,6 +3041,9 @@ expand_DEFERRED_INIT (internal_fn, gcall *stmt)
>    tree var_type = TREE_TYPE (lhs);
>    gcc_assert (init_type > AUTO_INIT_UNINITIALIZED);
>  
> +  if (OPAQUE_TYPE_P (var_type))
> +    return;
> +
>    if (TREE_CODE (lhs) == SSA_NAME)
>      reg_lhs = true;
>    else

Reply via email to