From 1f8e994ce9960687917d0fca2fef96af3080da50 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 13 Apr 2007 20:34:36 +0200 Subject: [PATCH] re PR fortran/31559 ([4.1 only] Assigning to an EXTERNAL leads to ICE) 2007-04-13 Tobias Burnus PR fortran/31559 * primary.c (match_variable): External functions are no variables. 2007-04-13 Tobias Burnus PR fortran/31559 * gfortran.dg/func_assign.f90: New test. From-SVN: r123793 --- gcc/fortran/ChangeLog | 42 +++++++++++++---------- gcc/fortran/primary.c | 3 +- gcc/testsuite/ChangeLog | 15 +++++--- gcc/testsuite/gfortran.dg/func_assign.f90 | 33 ++++++++++++++++++ 4 files changed, 69 insertions(+), 24 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/func_assign.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index df60120a5ff..aaad10f7f07 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,9 +1,15 @@ -2007-04-13 Paul Thomas - - PR fortran/31550 - * trans-types.c (copy_dt_decls_ifequal): Do not get pointer - derived type components. - +2007-04-13 Tobias Burnus + + PR fortran/31559 + * primary.c (match_variable): External functions + are no variables. + +2007-04-13 Paul Thomas + + PR fortran/31550 + * trans-types.c (copy_dt_decls_ifequal): Do not get pointer + derived type components. + 2007-04-13 Tobias Schlüter PR fortran/18937 @@ -106,18 +112,18 @@ * parse.c (parse_progunit): Call it after parsing specification statements. -2007-04-05 Paul Thomas - - 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 - - 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-05 Paul Thomas + + 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 + + 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 PR fortran/31304 diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 1ef37a69551..e31e1c5dbfd 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 04007bc8196..56f8ff81360 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,8 +1,13 @@ -2007-04-13 Paul Thomas - - PR fortran/31550 - * gfortran.dg/used_types_16.f90: New test. - +2007-04-13 Tobias Burnus + + PR fortran/31559 + * gfortran.dg/func_assign.f90: New test. + +2007-04-13 Paul Thomas + + PR fortran/31550 + * gfortran.dg/used_types_16.f90: New test. + 2007-04-13 Tobias Schlüter 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 index 00000000000..3651dfded2e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/func_assign.f90 @@ -0,0 +1,33 @@ +! { dg-do compile } +! +! PR fortran/31559 +! Do not allow assigning to external functions +! +! Contributed by Steve Kargl +! +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