]> gcc.gnu.org Git - gcc.git/commitdiff
re PR fortran/37254 (Reject valid PROCEDURE statement with implicit interface)
authorJanus Weil <janus@gcc.gnu.org>
Mon, 22 Jun 2009 21:02:19 +0000 (23:02 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Mon, 22 Jun 2009 21:02:19 +0000 (23:02 +0200)
2009-06-22  Janus Weil  <janus@gcc.gnu.org>

PR fortran/37254
PR fortran/39850
* interface.c (compare_parameter): Set implicit type for function
actual arguments with BT_UNKNOWN.

2009-06-22  Janus Weil  <janus@gcc.gnu.org>

PR fortran/37254
PR fortran/39850
* gfortran.dg/interface_30.f90: Modified error message.
* gfortran.dg/proc_decl_22.f90: New.

From-SVN: r148816

gcc/fortran/ChangeLog
gcc/fortran/interface.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/interface_30.f90
gcc/testsuite/gfortran.dg/proc_decl_22.f90 [new file with mode: 0755]

index b502caf53aee5e0766565964eef5834abce2eb5b..cda349d35bbe57b852a23bafd410fd0e12b0106e 100644 (file)
@@ -1,3 +1,10 @@
+2009-06-22  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/37254
+       PR fortran/39850
+       * interface.c (compare_parameter): Set implicit type for function
+       actual arguments with BT_UNKNOWN.
+
 2009-06-22  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/40472
index 53cc95fe76ee6139fce13ac36169644ad8eb894d..c6da6f880ddc590a358f62ea289ad40cc24d5a1b 100644 (file)
@@ -1407,9 +1407,14 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
        }
 
       if (formal->attr.function && !act_sym->attr.function)
-       gfc_add_function (&act_sym->attr, act_sym->name, &act_sym->declared_at);
-
-      if (formal->attr.subroutine && !act_sym->attr.subroutine)
+       {
+         gfc_add_function (&act_sym->attr, act_sym->name,
+         &act_sym->declared_at);
+         if (act_sym->ts.type == BT_UNKNOWN
+             && gfc_set_default_type (act_sym, 1, act_sym->ns) == FAILURE)
+           return 0;
+       }
+      else if (formal->attr.subroutine && !act_sym->attr.subroutine)
        gfc_add_subroutine (&act_sym->attr, act_sym->name,
                            &act_sym->declared_at);
 
index 2bb9f6f8695a62834edd15d1d01c369fe4e6f9ce..59918e1f40b0b7c79b393df458d0cf04decc6cfd 100644 (file)
@@ -1,3 +1,10 @@
+2009-06-22  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/37254
+       PR fortran/39850
+       * gfortran.dg/interface_30.f90: Modified error message.
+       * gfortran.dg/proc_decl_22.f90: New.
+
 2009-06-22  Ian Lance Taylor  <iant@google.com>
 
        * gcc.dg/Wcxx-compat-19.c: New testcase.
index 0576a42510efbb4b96109fca3b0c1c39649e93ec..cfea7068ab2aa99f6f1add6b0109b5720918d23c 100644 (file)
@@ -15,9 +15,9 @@ program test
   call sub1(func1)
   call sub2(func2)
   call sub1(func3)
-  call sub2(func3)  ! { dg-error "Type mismatch in argument" }
+  call sub2(func3)  ! { dg-error "is not a subroutine" }
   call sub2(func4)
-  call sub1(func4)  ! { dg-error "Interface mismatch in dummy procedure" }
+  call sub1(func4)  ! { dg-error "is not a function" }
 contains
   subroutine sub1(a1)
     interface
diff --git a/gcc/testsuite/gfortran.dg/proc_decl_22.f90 b/gcc/testsuite/gfortran.dg/proc_decl_22.f90
new file mode 100755 (executable)
index 0000000..4006006
--- /dev/null
@@ -0,0 +1,25 @@
+! { dg-do compile }
+!
+! PR 37254: Reject valid PROCEDURE statement with implicit interface
+!
+! Original test case by Dominique d'Humieres <dominiq@lps.ens.fr>
+! Modified by Janus Weil <janus@gcc.gnu.org>
+
+  real function proc3( arg1 )
+     integer :: arg1
+     proc3 = arg1+7
+  end function proc3
+
+program myProg
+  PROCEDURE () :: proc3
+  call proc4( proc3 )
+
+contains
+
+  subroutine proc4( arg1 )
+     PROCEDURE(real) :: arg1
+     print*, 'the func: ', arg1(0)
+  end subroutine proc4
+
+end program myProg
+
This page took 0.091964 seconds and 5 git commands to generate.