[Bug fortran/47569] [4.3/4.4/4.5/4.6 Regression] gfortran does not detect that the parameters for passing a partial string to a subroutine are incorrect
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Feb 1 11:33:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47569
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-02-01 11:33:33 UTC ---
A bit unrelated to the reported problem, but I wonder whether the
coarray/coindexed part is already correctly checked for:
"If the actual argument is a coindexed scalar, the corresponding dummy argument
shall be scalar. If the actual argument is a noncoindexed scalar, the
corresponding dummy argument shall be scalar unless the actual argument
is default character, of type character with the C character kind (15.2.2), or
is an element or substring of an element of an array that is not an
assumed-shape, pointer, or polymorphic array." (F2008)
* * *
Draft patch:
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 1e5df61..28daf8a 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1672,7 +1672,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
return 1;
/* At this point, we are considering a scalar passed to an array. This
- is valid (cf. F95 12.4.1.1; F2003 12.4.1.2),
+ is valid (cf. F95 12.4.1.1 and F2008 12.5.2.4; F2003 12.4.1.2),
- if the actual argument is (a substring of) an element of a
non-assumed-shape/non-pointer array;
- (F2003) if the actual argument is of type character. */
@@ -1686,8 +1686,8 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
if (formal->ts.type == BT_CHARACTER
&& (ref == NULL
|| (actual->expr_type == EXPR_VARIABLE
- && (actual->symtree->n.sym->as->type == AS_ASSUMED_SHAPE
- || actual->symtree->n.sym->attr.pointer))))
+ && (ref->u.ar.as->type == AS_ASSUMED_SHAPE
+ || gfc_expr_attr (actual).pointer))))
{
if (where && (gfc_option.allow_std & GFC_STD_F2003) == 0)
{
More information about the Gcc-bugs
mailing list