diff mbox

[fortran] PR50405 - Statement function with itself as argument SEGV's

Message ID 1369540690.43066.YahooMailClassic@web182204.mail.bf1.yahoo.com
State New
Headers show

Commit Message

Bud Davis May 26, 2013, 3:58 a.m. UTC
The changes suggested by:

http://gcc.gnu.org/ml/fortran/2013-05/msg00057.html

have been made in the below diff and test file.

Could someone please commit this ?  

It has been approved, see the above referenced message.

thanks,
Bud Davis







!{ dg-do compile }
! pr50405
! submitted by zeccav@gmail.com
!{ dg-prune-output "Obsolescent feature: Statement function at" }
       f(f) = 0 ! { dg-error "Self referential argument" }
       end

2013-05-26  Bud Davis  <jmdavis@link.com>

        PR fortran/50405
        resolve.c (resolve_formal_arglist): Detect error when an argument
        has the same name as the function.
diff mbox

Patch

Index: gcc/gcc/fortran/resolve.c
===================================================================
--- gcc/gcc/fortran/resolve.c	(revision 199330)
+++ gcc/gcc/fortran/resolve.c	(working copy)
@@ -306,6 +306,14 @@ 
 	       && !resolve_procedure_interface (sym))
 	return;
 
+      if (strcmp (proc->name, sym->name) == 0)
+        {
+          gfc_error ("Self-referential argument "
+                     "'%s' at %L is not allowed", sym->name,
+                     &proc->declared_at);
+          return;
+        }
+
       if (sym->attr.if_source != IFSRC_UNKNOWN)
 	resolve_formal_arglist (sym);