[Bug fortran/38506] -std=f*: Reject scalar character to array dummy in several cases

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Dec 15 09:45:00 GMT 2008



------- Comment #1 from burnus at gcc dot gnu dot org  2008-12-15 09:44 -------
Answer by Bader:

"For generics, the "R" part of the TKR rule applies, which prohibits *both*
above cases."

=> gfortran does it right. (I'm not fully convinced, but I buy this.)


Diagnostics: Bader writes:

"For handing on c_char scalars to char * an exception was made in F2003,
 allowing scalars to be matched to an entity with the dimension(*) attribute;
 otherwise dimension(*) will match arrays only, though of arbitrary dimension."

I think this is partially misleading. I think "12.4.1.5 Sequence association"
is relevant and it also applies to default character.

I.e. one seemingly needs to rejected this for kind=4 character strings with
-std=f2003:

Index: interface.c
===================================================================
--- interface.c (Revision 142761)
+++ interface.c (Arbeitskopie)
@@ -1525,6 +1525,12 @@ compare_parameter (gfc_symbol *formal, g
                     formal->name, &actual->where);
          return 0;
        }
+      else if (where && formal->ts.kind != 1
+              && gfc_notify_std (GFC_STD_GNU, "Extension: Non-default-kind"
+                                 "/C_CHAR scalar CHARACTER actual argument "
+                                 "with array dummy argument '%s' at %L",
+                                 formal->name, &actual->where) == FAILURE)
+       return 0;
       else if ((gfc_option.allow_std & GFC_STD_F2003) == 0)
        return 0;
       else


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |
            Summary|Character storage           |-std=f*: Reject scalar
                   |association - actual <->    |character to array dummy in
                   |dummy argument              |several cases


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38506



More information about the Gcc-bugs mailing list