OSDN Git Service

2007-04-13 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 13 Apr 2007 18:34:36 +0000 (18:34 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 13 Apr 2007 18:34:36 +0000 (18:34 +0000)
PR fortran/31559
* primary.c (match_variable): External functions
are no variables.

2007-04-13  Tobias Burnus  <burnus@net-b.de>

PR fortran/31559
* gfortran.dg/func_assign.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123793 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/primary.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/func_assign.f90 [new file with mode: 0644]

index df60120..aaad10f 100644 (file)
@@ -1,9 +1,15 @@
-2007-04-13  Paul Thomas  <pault@gcc.gnu.org>\r
-\r
-       PR fortran/31550\r
-       * trans-types.c (copy_dt_decls_ifequal): Do not get pointer\r
-       derived type components.\r
-\r
+2007-04-13  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/31559
+       * primary.c (match_variable): External functions
+       are no variables.
+
+2007-04-13  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/31550
+       * trans-types.c (copy_dt_decls_ifequal): Do not get pointer
+       derived type components.
+
 2007-04-13  Tobias Schlüter  <tobi@gcc.gnu.org>
 
        PR fortran/18937
        * parse.c (parse_progunit): Call it after parsing specification
        statements.
 
-2007-04-05  Paul Thomas  <pault@gcc.gnu.org>\r
-\r
-       PR fortran/31483\r
-       * trans-expr.c (gfc_conv_function_call): Give a dummy\r
-       procedure the correct type if it has alternate returns.\r
-\r
-2007-04-05  Paul Thomas  <pault@gcc.gnu.org>\r
-\r
-       PR fortran/31292\r
-       * decl.c (gfc_match_modproc): Go up to the top of the namespace\r
-       tree to find the module namespace for gfc_get_symbol.\r
-\r
+2007-04-05  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/31483
+       * trans-expr.c (gfc_conv_function_call): Give a dummy
+       procedure the correct type if it has alternate returns.
+
+2007-04-05  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/31292
+       * decl.c (gfc_match_modproc): Go up to the top of the namespace
+       tree to find the module namespace for gfc_get_symbol.
+
 2007-04-03  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        PR fortran/31304
index 1ef37a6..e31e1c5 100644 (file)
@@ -2420,7 +2420,8 @@ match_variable (gfc_expr **result, int equiv_flag, int host_flag)
 
     case FL_PROCEDURE:
       /* Check for a nonrecursive function result */
-      if (sym->attr.function && (sym->result == sym || sym->attr.entry))
+      if (sym->attr.function && (sym->result == sym || sym->attr.entry)
+         && !sym->attr.external)
        {
          /* If a function result is a derived type, then the derived
             type may still have to be resolved.  */
index 04007bc..56f8ff8 100644 (file)
@@ -1,8 +1,13 @@
-2007-04-13  Paul Thomas  <pault@gcc.gnu.org>\r
-\r
-       PR fortran/31550\r
-       * gfortran.dg/used_types_16.f90: New test.\r
-\r
+2007-04-13  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/31559
+       * gfortran.dg/func_assign.f90: New test.
+
+2007-04-13  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/31550
+       * gfortran.dg/used_types_16.f90: New test.
+
 2007-04-13  Tobias Schlüter  <tobi@gcc.gnu.org>
 
        PR fortran/18937
diff --git a/gcc/testsuite/gfortran.dg/func_assign.f90 b/gcc/testsuite/gfortran.dg/func_assign.f90
new file mode 100644 (file)
index 0000000..3651dfd
--- /dev/null
@@ -0,0 +1,33 @@
+! { dg-do compile }
+!
+! PR fortran/31559
+! Do not allow assigning to external functions
+!
+! Contributed by Steve Kargl <sgk@troutmask.apl.washington.edu>
+!
+module mod
+  implicit none
+contains
+  integer function bar()
+    bar = 4
+  end function bar
+
+  subroutine a() 
+   implicit none
+   real :: fun
+   external fun
+   interface
+     function funget(a)
+       integer :: a
+     end function
+     subroutine sub()
+     end subroutine sub
+   end interface
+   sub = 'a'  ! { dg-error "Expected VARIABLE" }
+   fun = 4.4  ! { dg-error "Expected VARIABLE" }
+   funget = 4 ! { dg-error "is not a VALUE" }
+   bar = 5    ! { dg-error "is not a VALUE" }
+  end subroutine a
+end module mod
+
+end