From 02c8c8d3c8688a4b10ec5541268e436fa13a0753 Mon Sep 17 00:00:00 2001 From: burnus Date: Sun, 6 Jan 2008 19:36:44 +0000 Subject: [PATCH] 2008-01-06 Tobias Burnus PR fortran/34689 * interface.c (compare_actual_formal): Fix intent(out) check for function result variables. 2008-01-06 Tobias Burnus PR fortran/34689 * gfortran.dg/intent_out_4.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131359 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/interface.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/intent_out_4.f90 | 18 ++++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/intent_out_4.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 932527e..09155e3 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2008-01-06 Tobias Burnus + + PR fortran/34689 + * interface.c (compare_actual_formal): Fix intent(out) check for + function result variables. + 2008-01-06 Jerry DeLisle PR fortran/34387 diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index b900b10..8088fc6 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -1909,7 +1909,8 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, /* Check intent = OUT/INOUT for definable actual argument. */ if ((a->expr->expr_type != EXPR_VARIABLE - || a->expr->symtree->n.sym->attr.flavor != FL_VARIABLE) + || (a->expr->symtree->n.sym->attr.flavor != FL_VARIABLE + && a->expr->symtree->n.sym->attr.flavor != FL_PROCEDURE)) && (f->sym->attr.intent == INTENT_OUT || f->sym->attr.intent == INTENT_INOUT)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e0c42668..1631fe9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-01-06 Tobias Burnus + + PR fortran/34689 + * gfortran.dg/intent_out_4.f90: New. + 2008-01-06 Jerry DeLisle PR libfortran/34540 diff --git a/gcc/testsuite/gfortran.dg/intent_out_4.f90 b/gcc/testsuite/gfortran.dg/intent_out_4.f90 new file mode 100644 index 0000000..e34c452 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/intent_out_4.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! +! PR fortran/34689 +! +! The following (cf. libgomp.fortran/appendix-a/a.33.3.f90) +! was rejected because the intent check missed a FL_FUNCTION +! for the result variable. +! +function test() + implicit none + integer :: test + interface + subroutine foo(a) + integer(inout) :: a + end subroutine foo + end interface + call foo(a) +end function test -- 2.7.4