Commit 8bae3cef by Janus Weil

re PR fortran/53956 ([F03] PROCEDURE w/ interface: Bogus "EXTERNAL attribute…

re PR fortran/53956 ([F03] PROCEDURE w/ interface: Bogus "EXTERNAL attribute conflicts with FUNCTION attribute")

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
parent d923fe0f
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> 2012-07-12 Tobias Burnus <burnus@net-b.de>
* trans-expr.c (conv_isocbinding_procedure): Generate c_f_pointer code * trans-expr.c (conv_isocbinding_procedure): Generate c_f_pointer code
......
...@@ -2638,9 +2638,9 @@ gfc_symbol* gfc_get_ultimate_derived_super_type (gfc_symbol*); ...@@ -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_is_extension_of (gfc_symbol *, gfc_symbol *);
bool gfc_type_compatible (gfc_typespec *, gfc_typespec *); 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_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 */ void gfc_free_finalizer (gfc_finalizer *el); /* Needed in resolve.c, too */
......
...@@ -173,7 +173,7 @@ resolve_procedure_interface (gfc_symbol *sym) ...@@ -173,7 +173,7 @@ resolve_procedure_interface (gfc_symbol *sym)
sym->ts.interface = ifc; sym->ts.interface = ifc;
sym->attr.function = ifc->attr.function; sym->attr.function = ifc->attr.function;
sym->attr.subroutine = ifc->attr.subroutine; 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.allocatable = ifc->attr.allocatable;
sym->attr.pointer = ifc->attr.pointer; sym->attr.pointer = ifc->attr.pointer;
...@@ -11790,7 +11790,7 @@ resolve_fl_derived0 (gfc_symbol *sym) ...@@ -11790,7 +11790,7 @@ resolve_fl_derived0 (gfc_symbol *sym)
c->ts.interface = ifc; c->ts.interface = ifc;
c->attr.function = ifc->attr.function; c->attr.function = ifc->attr.function;
c->attr.subroutine = ifc->attr.subroutine; 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.pure = ifc->attr.pure;
c->attr.elemental = ifc->attr.elemental; c->attr.elemental = ifc->attr.elemental;
......
...@@ -4049,8 +4049,7 @@ gen_shape_param (gfc_formal_arglist **head, ...@@ -4049,8 +4049,7 @@ gen_shape_param (gfc_formal_arglist **head,
reference to the list of formal arguments). */ reference to the list of formal arguments). */
static void static void
add_proc_interface (gfc_symbol *sym, ifsrc source, add_proc_interface (gfc_symbol *sym, ifsrc source, gfc_formal_arglist *formal)
gfc_formal_arglist *formal)
{ {
sym->formal = formal; sym->formal = formal;
...@@ -4066,7 +4065,7 @@ add_proc_interface (gfc_symbol *sym, ifsrc source, ...@@ -4066,7 +4065,7 @@ add_proc_interface (gfc_symbol *sym, ifsrc source,
args based on the args of a given named interface. */ args based on the args of a given named interface. */
void 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 *head = NULL;
gfc_formal_arglist *tail = NULL; gfc_formal_arglist *tail = NULL;
...@@ -4090,7 +4089,8 @@ gfc_copy_formal_args (gfc_symbol *dest, gfc_symbol *src) ...@@ -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->attr = curr_arg->sym->attr;
formal_arg->sym->ts = curr_arg->sym->ts; formal_arg->sym->ts = curr_arg->sym->ts;
formal_arg->sym->as = gfc_copy_array_spec (curr_arg->sym->as); 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 /* 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 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) ...@@ -4110,7 +4110,7 @@ gfc_copy_formal_args (gfc_symbol *dest, gfc_symbol *src)
} }
/* Add the interface to the symbol. */ /* 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. */ /* Store the formal namespace information. */
if (dest->formal != NULL) if (dest->formal != NULL)
...@@ -4183,7 +4183,7 @@ gfc_copy_formal_args_intr (gfc_symbol *dest, gfc_intrinsic_sym *src) ...@@ -4183,7 +4183,7 @@ gfc_copy_formal_args_intr (gfc_symbol *dest, gfc_intrinsic_sym *src)
void 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 *head = NULL;
gfc_formal_arglist *tail = NULL; gfc_formal_arglist *tail = NULL;
...@@ -4207,7 +4207,8 @@ gfc_copy_formal_args_ppc (gfc_component *dest, gfc_symbol *src) ...@@ -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->attr = curr_arg->sym->attr;
formal_arg->sym->ts = curr_arg->sym->ts; formal_arg->sym->ts = curr_arg->sym->ts;
formal_arg->sym->as = gfc_copy_array_spec (curr_arg->sym->as); 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 /* 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 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) ...@@ -4229,7 +4230,7 @@ gfc_copy_formal_args_ppc (gfc_component *dest, gfc_symbol *src)
/* Add the interface to the symbol. */ /* Add the interface to the symbol. */
gfc_free_formal_arglist (dest->formal); gfc_free_formal_arglist (dest->formal);
dest->formal = head; dest->formal = head;
dest->attr.if_source = IFSRC_DECL; dest->attr.if_source = if_src;
/* Store the formal namespace information. */ /* Store the formal namespace information. */
if (dest->formal != NULL) if (dest->formal != NULL)
......
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> 2012-07-16 Andrew Pinski <apinski@cavium.com>
* gcc.dg/torture/builtins-1.c: New testcase. * gcc.dg/torture/builtins-1.c: New testcase.
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment