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

--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to anlauf from comment #12)
> (In reply to Andrew Pinski from comment #11)
> > I wonder why gfc_return_by_reference is not returning true here because I
> > think that would be idea here.
> 
> Good point.  Tentative patch which excepts (d)conjg:
> 
> diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc
> index f8980754685..e1e4f1604cd 100644
> --- a/gcc/fortran/trans-types.cc
> +++ b/gcc/fortran/trans-types.cc
> @@ -3237,7 +3237,10 @@ gfc_return_by_reference (gfc_symbol * sym)
>    if (flag_f2c && sym->ts.type == BT_COMPLEX
>        && !sym->attr.pointer
>        && !sym->attr.allocatable
> -      && !sym->attr.intrinsic && !sym->attr.always_explicit)
> +      && (!sym->attr.intrinsic
> +       || strcmp (sym->name, "conjg") == 0
> +       || strcmp (sym->name, "dconjg") == 0)
> +      && !sym->attr.always_explicit)
>      return 1;
>  
>    return 0;

Does it fix the whole original testcase? Because I just tried to reduce it into
one of the failures

Reply via email to