public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, Fortran] PR 40453: Enhanced (recursive) argument checking
@ 2012-10-06 22:15 Janus Weil
  2012-10-11 21:44 ` Janus Weil
  0 siblings, 1 reply; 4+ messages in thread
From: Janus Weil @ 2012-10-06 22:15 UTC (permalink / raw)
  To: gfortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

Hi all,

here is a rather straightforward patch, which does 'recursive'
checking of dummy procedures.

Regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus


2012-10-06  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/40453
	* interface.c (check_dummy_characteristics): Recursively check dummy
	procedures.

2012-10-06  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/40453
	* gfortran.dg/dummy_procedure_9.f90: New.

[-- Attachment #2: pr40453.diff --]
[-- Type: application/octet-stream, Size: 860 bytes --]

Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c	(revision 192159)
+++ gcc/fortran/interface.c	(working copy)
@@ -1063,6 +1063,19 @@ check_dummy_characteristics (gfc_symbol *s1, gfc_s
   /* FIXME: Do more comprehensive testing of attributes, like e.g.
 	    ASYNCHRONOUS, CONTIGUOUS, VALUE, VOLATILE, etc.  */
 
+  /* Check interface of dummy procedures.  */
+  if (s1->attr.flavor == FL_PROCEDURE)
+    {
+      char err[200];
+      if (!gfc_compare_interfaces (s1, s2, s2->name, 0, 1, err, sizeof(err),
+				   NULL, NULL))
+	{
+	  snprintf (errmsg, err_len, "Interface mismatch in dummy procedure "
+		    "'%s': %s", s1->name, err);
+	  return FAILURE;
+	}
+    }
+
   /* Check string length.  */
   if (s1->ts.type == BT_CHARACTER
       && s1->ts.u.cl && s1->ts.u.cl->length

[-- Attachment #3: dummy_procedure_9.f90 --]
[-- Type: application/octet-stream, Size: 612 bytes --]

! { dg-do compile }
!
! PR 40453: [F95] Enhanced (recursive) argument checking
!
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>

program RecursiveInterface
  
  call c(b2)  ! { dg-error "Interface mismatch in dummy procedure" }

 contains

    subroutine a1(x)
      real :: x
    end subroutine

    subroutine a2(i)
      integer :: i
    end subroutine

    !!!!!!!!!!!!!!!

    subroutine b1 (f1)
      procedure(a1) :: f1
    end subroutine

    subroutine b2 (f2)
      procedure(a2) :: f2
    end subroutine

    !!!!!!!!!!!!!!!

    subroutine c(g)
     procedure(b1) :: g
    end subroutine
  
end

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch, Fortran] PR 40453: Enhanced (recursive) argument checking
  2012-10-06 22:15 [Patch, Fortran] PR 40453: Enhanced (recursive) argument checking Janus Weil
@ 2012-10-11 21:44 ` Janus Weil
  2012-10-11 23:34   ` Thomas Koenig
  0 siblings, 1 reply; 4+ messages in thread
From: Janus Weil @ 2012-10-11 21:44 UTC (permalink / raw)
  To: gfortran, gcc-patches

ping!


2012/10/7 Janus Weil <janus@gcc.gnu.org>:
> Hi all,
>
> here is a rather straightforward patch, which does 'recursive'
> checking of dummy procedures.
>
> Regtested on x86_64-unknown-linux-gnu. Ok for trunk?
>
> Cheers,
> Janus
>
>
> 2012-10-06  Janus Weil  <janus@gcc.gnu.org>
>
>         PR fortran/40453
>         * interface.c (check_dummy_characteristics): Recursively check dummy
>         procedures.
>
> 2012-10-06  Janus Weil  <janus@gcc.gnu.org>
>
>         PR fortran/40453
>         * gfortran.dg/dummy_procedure_9.f90: New.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch, Fortran] PR 40453: Enhanced (recursive) argument checking
  2012-10-11 21:44 ` Janus Weil
@ 2012-10-11 23:34   ` Thomas Koenig
  2012-10-12  8:22     ` Janus Weil
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Koenig @ 2012-10-11 23:34 UTC (permalink / raw)
  To: Janus Weil; +Cc: gfortran, gcc-patches

Hi Janus,

> ping!
>
>
> 2012/10/7 Janus Weil <janus@gcc.gnu.org>:
>> Hi all,
>>
>> here is a rather straightforward patch, which does 'recursive'
>> checking of dummy procedures.
>>
>> Regtested on x86_64-unknown-linux-gnu. Ok for trunk?

This is OK.  Thanks for the patch!

	Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch, Fortran] PR 40453: Enhanced (recursive) argument checking
  2012-10-11 23:34   ` Thomas Koenig
@ 2012-10-12  8:22     ` Janus Weil
  0 siblings, 0 replies; 4+ messages in thread
From: Janus Weil @ 2012-10-12  8:22 UTC (permalink / raw)
  To: Thomas Koenig; +Cc: gfortran, gcc-patches

Hi Thomas,

>>> here is a rather straightforward patch, which does 'recursive'
>>> checking of dummy procedures.
>>>
>>> Regtested on x86_64-unknown-linux-gnu. Ok for trunk?
>
>
> This is OK.  Thanks for the patch!

thanks, committed as r192391.

Cheers,
Janus

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-12  8:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-06 22:15 [Patch, Fortran] PR 40453: Enhanced (recursive) argument checking Janus Weil
2012-10-11 21:44 ` Janus Weil
2012-10-11 23:34   ` Thomas Koenig
2012-10-12  8:22     ` Janus Weil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).