diff options
author | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-06 09:07:47 +0000 |
---|---|---|
committer | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-06 09:07:47 +0000 |
commit | 6da3802f1f2b49535f6e563fef8885684c94da12 (patch) | |
tree | cbdd147b3dc5efc685848f0b3084142c55373706 /gcc | |
parent | a7a57fdeef85e01ab46572a69717f435d105a3e2 (diff) | |
download | gcc-6da3802f1f2b49535f6e563fef8885684c94da12.tar.gz |
2008-01-06 Tobias Burnus <burnus@net-b.de>
PR fortran/34662
* interface.c (compare_actual_formal): Reject parameter
actual to intent(out) dummy.
2008-01-06 Tobias Burnus <burnus@net-b.de>
PR fortran/34662
* gfortran.dg/intent_out_3.f90: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131348 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/interface.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/intent_out_3.f90 | 19 |
4 files changed, 35 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 82f4cd7aea4..43d7519d13a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2008-01-06 Tobias Burnus <burnus@net-b.de> + + PR fortran/34662 + * interface.c (compare_actual_formal): Reject parameter + actual to intent(out) dummy. + 2008-01-04 Tobias Burnus <burnus@net-b.de> PR fortran/34557 diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 519251efb2e..b900b102fe5 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -1908,13 +1908,15 @@ 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 + if ((a->expr->expr_type != EXPR_VARIABLE + || a->expr->symtree->n.sym->attr.flavor != FL_VARIABLE) && (f->sym->attr.intent == INTENT_OUT || f->sym->attr.intent == INTENT_INOUT)) { if (where) - gfc_error ("Actual argument at %L must be definable to " - "match dummy INTENT = OUT/INOUT", &a->expr->where); + gfc_error ("Actual argument at %L must be definable as " + "the dummy argument '%s' is INTENT = OUT/INOUT", + &a->expr->where, f->sym->name); return 0; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8519caecd7f..5cecf0642e6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-01-06 Tobias Burnus <burnus@net-b.de> + + PR fortran/34662 + * gfortran.dg/intent_out_3.f90: New. + 2008-01-05 Richard Sandiford <rsandifo@nildram.co.uk> * objc.dg/stabs-1.m: Allow labels to be begin with $L as well as .L. diff --git a/gcc/testsuite/gfortran.dg/intent_out_3.f90 b/gcc/testsuite/gfortran.dg/intent_out_3.f90 new file mode 100644 index 00000000000..7b68a352246 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/intent_out_3.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! +! PR fortran/34662 +! The INTENT error was not detected. +! Test case contributed by Joost VandeVondele. +! +MODULE M1 + TYPE T1 + INTEGER :: I(3) + END TYPE T1 + TYPE(T1), PARAMETER :: D1=T1((/1,2,3/)) +CONTAINS + SUBROUTINE S1(J) + INTEGER, INTENT(INOUT) :: J + END SUBROUTINE S1 +END MODULE M1 +USE M1 +CALL S1(D1%I(3)) ! { dg-error "must be definable" } +END |