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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #3 from anlauf at gcc dot gnu.org ---
(In reply to José Rui Faustino de Sousa from comment #1)
> Patch posted
> 
> https://gcc.gnu.org/pipermail/fortran/2021-April/055946.html

The patch is technically fine and regtests ok, but was unfortunately never
reviewed.

The basic fix can be slightly shortened to:

diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc
index 0ea7c74a6f1..c062a5b29d7 100644
--- a/gcc/fortran/trans-types.cc
+++ b/gcc/fortran/trans-types.cc
@@ -3054,12 +3054,23 @@ create_fn_spec (gfc_symbol *sym, tree fntype)
   for (f = gfc_sym_get_dummy_args (sym); f; f = f->next)
     if (spec_len < sizeof (spec))
       {
-       if (!f->sym || f->sym->attr.pointer || f->sym->attr.target
+       bool is_class = false;
+       bool is_pointer = false;
+
+       if (f->sym)
+         {
+           is_class = f->sym->ts.type == BT_CLASS && CLASS_DATA (f->sym)
+             && f->sym->attr.class_ok;
+           is_pointer = is_class ? CLASS_DATA (f->sym)->attr.class_pointer
+                                 : f->sym->attr.pointer;
+         }
+
+       if (f->sym == NULL || is_pointer || f->sym->attr.target
            || f->sym->attr.external || f->sym->attr.cray_pointer
            || (f->sym->ts.type == BT_DERIVED
                && (f->sym->ts.u.derived->attr.proc_pointer_comp
                    || f->sym->ts.u.derived->attr.pointer_comp))
-           || (f->sym->ts.type == BT_CLASS
+           || (is_class
                && (CLASS_DATA (f->sym)->ts.u.derived->attr.proc_pointer_comp
                    || CLASS_DATA (f->sym)->ts.u.derived->attr.pointer_comp))
            || (f->sym->ts.type == BT_INTEGER && f->sym->ts.is_c_interop))

I can take care of it for you.

Reply via email to