re PR fortran/53956 ([F03] PROCEDURE w/ interface: Bogus "EXTERNAL attribute conflict...
authorJanus Weil <janus@gcc.gnu.org>
Mon, 16 Jul 2012 10:13:19 +0000 (12:13 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Mon, 16 Jul 2012 10:13:19 +0000 (12:13 +0200)
2012-07-16  Janus Weil  <janus@gcc.gnu.org>

PR fortran/53956
* gfortran.h (gfc_copy_formal_args,gfc_copy_formal_args_ppc): Modified
prototypes.
* symbol.c (gfc_copy_formal_args): New argument 'if_src'. Copy if_source
of dummy procedures.
(gfc_copy_formal_args_ppc): Ditto.
* resolve.c (resolve_procedure_interface): Pass IFSRC_DECL to
gfc_copy_formal_args.
(resolve_fl_derived0): Pass IFSRC_DECL to gfc_copy_formal_args_ppc.

2012-07-16  Janus Weil  <janus@gcc.gnu.org>

PR fortran/53956
* gfortran.dg/proc_decl_28.f90: New.

From-SVN: r189514

gcc/fortran/ChangeLog
gcc/fortran/gfortran.h
gcc/fortran/resolve.c
gcc/fortran/symbol.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/proc_decl_28.f90 [new file with mode: 0644]

index f6be5bde2cc11150413656d8d113f0a7ddb05d15..3cfa4bab507d8c93552c1103a1ff0ae7d048a1f1 100644 (file)
@@ -1,3 +1,15 @@
+2012-07-16  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/53956
+       * gfortran.h (gfc_copy_formal_args,gfc_copy_formal_args_ppc): Modified
+       prototypes.
+       * symbol.c (gfc_copy_formal_args): New argument 'if_src'. Copy if_source
+       of dummy procedures.
+       (gfc_copy_formal_args_ppc): Ditto.
+       * resolve.c (resolve_procedure_interface): Pass IFSRC_DECL to
+       gfc_copy_formal_args.
+       (resolve_fl_derived0): Pass IFSRC_DECL to gfc_copy_formal_args_ppc.
+
 2012-07-12  Tobias Burnus  <burnus@net-b.de>
 
        * trans-expr.c (conv_isocbinding_procedure): Generate c_f_pointer code
index 6d75e632088c58914991a3b8c66e82746e7905e5..fa06883123e7d88fcee82d9a38efd83cc70d3057 100644 (file)
@@ -2638,9 +2638,9 @@ gfc_symbol* gfc_get_ultimate_derived_super_type (gfc_symbol*);
 bool gfc_type_is_extension_of (gfc_symbol *, gfc_symbol *);
 bool gfc_type_compatible (gfc_typespec *, gfc_typespec *);
 
-void gfc_copy_formal_args (gfc_symbol *, gfc_symbol *);
+void gfc_copy_formal_args (gfc_symbol *, gfc_symbol *, ifsrc);
 void gfc_copy_formal_args_intr (gfc_symbol *, gfc_intrinsic_sym *);
-void gfc_copy_formal_args_ppc (gfc_component *, gfc_symbol *);
+void gfc_copy_formal_args_ppc (gfc_component *, gfc_symbol *, ifsrc);
 
 void gfc_free_finalizer (gfc_finalizer *el); /* Needed in resolve.c, too  */
 
index 5be1857ef79daaba49f538e848909fbc01390e98..03f74df88fa1119e41dadb3c0f74f5155fe18c5d 100644 (file)
@@ -173,7 +173,7 @@ resolve_procedure_interface (gfc_symbol *sym)
       sym->ts.interface = ifc;
       sym->attr.function = ifc->attr.function;
       sym->attr.subroutine = ifc->attr.subroutine;
-      gfc_copy_formal_args (sym, ifc);
+      gfc_copy_formal_args (sym, ifc, IFSRC_DECL);
 
       sym->attr.allocatable = ifc->attr.allocatable;
       sym->attr.pointer = ifc->attr.pointer;
@@ -11790,7 +11790,7 @@ resolve_fl_derived0 (gfc_symbol *sym)
              c->ts.interface = ifc;
              c->attr.function = ifc->attr.function;
              c->attr.subroutine = ifc->attr.subroutine;
-             gfc_copy_formal_args_ppc (c, ifc);
+             gfc_copy_formal_args_ppc (c, ifc, IFSRC_DECL);
 
              c->attr.pure = ifc->attr.pure;
              c->attr.elemental = ifc->attr.elemental;
index 378f83c23ddc23202b27d09ccc4c60d50cd8b4f8..99fa27d700e6b6d326f9851498a5b52468e59f7c 100644 (file)
@@ -4049,8 +4049,7 @@ gen_shape_param (gfc_formal_arglist **head,
    reference to the list of formal arguments).  */
 
 static void
-add_proc_interface (gfc_symbol *sym, ifsrc source,
-                    gfc_formal_arglist *formal)
+add_proc_interface (gfc_symbol *sym, ifsrc source, gfc_formal_arglist *formal)
 {
 
   sym->formal = formal;
@@ -4066,7 +4065,7 @@ add_proc_interface (gfc_symbol *sym, ifsrc source,
    args based on the args of a given named interface.  */
 
 void
-gfc_copy_formal_args (gfc_symbol *dest, gfc_symbol *src)
+gfc_copy_formal_args (gfc_symbol *dest, gfc_symbol *src, ifsrc if_src)
 {
   gfc_formal_arglist *head = NULL;
   gfc_formal_arglist *tail = NULL;
@@ -4090,7 +4089,8 @@ gfc_copy_formal_args (gfc_symbol *dest, gfc_symbol *src)
       formal_arg->sym->attr = curr_arg->sym->attr;
       formal_arg->sym->ts = curr_arg->sym->ts;
       formal_arg->sym->as = gfc_copy_array_spec (curr_arg->sym->as);
-      gfc_copy_formal_args (formal_arg->sym, curr_arg->sym);
+      gfc_copy_formal_args (formal_arg->sym, curr_arg->sym,
+                           curr_arg->sym->attr.if_source);
 
       /* If this isn't the first arg, set up the next ptr.  For the
         last arg built, the formal_arg->next will never get set to
@@ -4110,7 +4110,7 @@ gfc_copy_formal_args (gfc_symbol *dest, gfc_symbol *src)
     }
 
   /* Add the interface to the symbol.  */
-  add_proc_interface (dest, IFSRC_DECL, head);
+  add_proc_interface (dest, if_src, head);
 
   /* Store the formal namespace information.  */
   if (dest->formal != NULL)
@@ -4183,7 +4183,7 @@ gfc_copy_formal_args_intr (gfc_symbol *dest, gfc_intrinsic_sym *src)
 
 
 void
-gfc_copy_formal_args_ppc (gfc_component *dest, gfc_symbol *src)
+gfc_copy_formal_args_ppc (gfc_component *dest, gfc_symbol *src, ifsrc if_src)
 {
   gfc_formal_arglist *head = NULL;
   gfc_formal_arglist *tail = NULL;
@@ -4207,7 +4207,8 @@ gfc_copy_formal_args_ppc (gfc_component *dest, gfc_symbol *src)
       formal_arg->sym->attr = curr_arg->sym->attr;
       formal_arg->sym->ts = curr_arg->sym->ts;
       formal_arg->sym->as = gfc_copy_array_spec (curr_arg->sym->as);
-      gfc_copy_formal_args (formal_arg->sym, curr_arg->sym);
+      gfc_copy_formal_args (formal_arg->sym, curr_arg->sym,
+                           curr_arg->sym->attr.if_source);
 
       /* If this isn't the first arg, set up the next ptr.  For the
         last arg built, the formal_arg->next will never get set to
@@ -4229,7 +4230,7 @@ gfc_copy_formal_args_ppc (gfc_component *dest, gfc_symbol *src)
   /* Add the interface to the symbol.  */
   gfc_free_formal_arglist (dest->formal);
   dest->formal = head;
-  dest->attr.if_source = IFSRC_DECL;
+  dest->attr.if_source = if_src;
 
   /* Store the formal namespace information.  */
   if (dest->formal != NULL)
index 21a10499b0c23a4e4f6f7f5aeab6ce9afb93f3d8..45f45317a025546f22879a5d043cf50063eb4ee3 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-16  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/53956
+       * gfortran.dg/proc_decl_28.f90: New.
+
 2012-07-16  Andrew Pinski  <apinski@cavium.com>
 
        * gcc.dg/torture/builtins-1.c: New testcase.
diff --git a/gcc/testsuite/gfortran.dg/proc_decl_28.f90 b/gcc/testsuite/gfortran.dg/proc_decl_28.f90
new file mode 100644 (file)
index 0000000..b3a557b
--- /dev/null
@@ -0,0 +1,15 @@
+! { dg-do compile }
+!
+! PR 53956: [F03] PROCEDURE w/ interface: Bogus "EXTERNAL attribute conflicts with FUNCTION attribute"
+!
+! Contributed by James van Buskirk
+
+  interface
+    subroutine sub (a)       
+      integer, external :: a
+    end subroutine
+  end interface
+
+  procedure(sub) :: proc
+
+end