summaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-03 16:51:52 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-03 16:51:52 +0000
commitb460b38698c7a2c2126250dec94f40a636635a66 (patch)
tree5f727c5c8d300e304725254cbdfbb8e159383810 /gcc/fortran
parent67e66e16928468050d4593ada24a16013fe3ca20 (diff)
downloadgcc-b460b38698c7a2c2126250dec94f40a636635a66.tar.gz
2009-11-03 Tobias Burnus <burnus@net-b.de>
PR fortran/41907 * trans-expr.c (gfc_conv_procedure_call): Fix presence check for optional arguments. 2009-11-03 Tobias Burnus <burnus@net-b.de> PR fortran/41907 * gfortran.dg/missing_optional_dummy_6.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153854 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-expr.c15
2 files changed, 15 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 717ffa025cb..8fc1175b35a 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-03 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/41907
+ * trans-expr.c (gfc_conv_procedure_call): Fix presence check
+ for optional arguments.
+
2009-11-01 Tobias Burnus <burnus@net-b.de>
PR fortran/41872
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index d8f8303fdbd..5a45f4f6368 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -2998,16 +2998,19 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
only needed when passing an array to an elemental procedure
as then array elements are accessed - or no NULL pointer is
allowed and a "1" or "0" should be passed if not present.
- When passing a deferred array to a non-deferred array dummy,
- the array needs to be packed and a check needs thus to be
- inserted. */
+ When passing a non-array-descriptor full array to a
+ non-array-descriptor dummy, no check is needed. For
+ array-descriptor actual to array-descriptor dummy, see
+ PR 41911 for why a check has to be inserted.
+ fsym == NULL is checked as intrinsics required the descriptor
+ but do not always set fsym. */
if (e->expr_type == EXPR_VARIABLE
&& e->symtree->n.sym->attr.optional
&& ((e->rank > 0 && sym->attr.elemental)
|| e->representation.length || e->ts.type == BT_CHARACTER
- || (e->rank > 0 && (fsym == NULL
- || (fsym->as->type != AS_ASSUMED_SHAPE
- && fsym->as->type != AS_DEFERRED)))))
+ || (e->rank > 0
+ && (fsym == NULL || fsym->as->type == AS_ASSUMED_SHAPE
+ || fsym->as->type == AS_DEFERRED))))
gfc_conv_missing_dummy (&parmse, e, fsym ? fsym->ts : e->ts,
e->representation.length);
}