From 4d4074e415dbf2029f49bef9fe48ed79c8c5a106 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Sat, 9 Dec 2006 20:41:51 +0000 Subject: [PATCH] re PR fortran/29941 ([4.1 only] gfortran reports error with len of assumed size character array) 2006-12-09 Paul Thomas PR fortran/29941 * resolve.c (resolve_function): Add LEN to the functions not checked for assumed size actual args. 2006-12-09 Paul Thomas PR fortran/29941 * gfortran.dg/assumed_len.f90: New test. From-SVN: r119695 --- gcc/fortran/ChangeLog | 14 ++++++++++---- gcc/fortran/resolve.c | 13 ++++++++----- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/assumed_len.f90 | 11 +++++++++++ 4 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/assumed_len.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index be404adad1c5..1a6b28afcde2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,14 +1,20 @@ +2006-12-09 Paul Thomas + + PR fortran/29941 + * resolve.c (resolve_function): Add LEN to the functions not + checked for assumed size actual args. + 2006-12-08 Tobias Burnus PR fortran/27546 - * trans-decl.f90 (gfc_create_module_variable): Allow imported symbols - in interface bodys in modules. + * trans-decl.c (gfc_create_module_variable): Allow imported + symbols in interface bodies in modules. 2006-12-06 Tobias Burnus PR fortran/29711 - * error.c (error_print): Fix handling of printf-style position specifiers - of the form "%3$d" + * error.c (error_print): Fix handling of printf-style position + specifiers of the form "%3$d". 2006-12-05 Paul Thomas diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index e31ecbd5909e..863e8319d091 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1514,19 +1514,21 @@ resolve_function (gfc_expr * expr) t = FAILURE; } +#define GENERIC_ID expr->value.function.isym->generic_id else if (expr->value.function.actual != NULL && expr->value.function.isym != NULL - && expr->value.function.isym->generic_id != GFC_ISYM_LBOUND - && expr->value.function.isym->generic_id != GFC_ISYM_LOC - && expr->value.function.isym->generic_id != GFC_ISYM_PRESENT) + && GENERIC_ID != GFC_ISYM_LBOUND + && GENERIC_ID != GFC_ISYM_LEN + && GENERIC_ID != GFC_ISYM_LOC + && GENERIC_ID != GFC_ISYM_PRESENT) { /* Array intrinsics must also have the last upper bound of an assumed size array argument. UBOUND and SIZE have to be excluded from the check if the second argument is anything than a constant. */ int inquiry; - inquiry = expr->value.function.isym->generic_id == GFC_ISYM_UBOUND - || expr->value.function.isym->generic_id == GFC_ISYM_SIZE; + inquiry = GENERIC_ID == GFC_ISYM_UBOUND + || GENERIC_ID == GFC_ISYM_SIZE; for (arg = expr->value.function.actual; arg; arg = arg->next) { @@ -1540,6 +1542,7 @@ resolve_function (gfc_expr * expr) return FAILURE; } } +#undef GENERIC_ID need_full_assumed_size = temp; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 74246f22db08..761d53bb6605 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-12-09 Paul Thomas + + PR fortran/29941 + * gfortran.dg/assumed_len.f90: New test. + 2006-12-09 Richard Guenther * g++.dg/warn/implicit-typename1.C: Qualify types. diff --git a/gcc/testsuite/gfortran.dg/assumed_len.f90 b/gcc/testsuite/gfortran.dg/assumed_len.f90 new file mode 100644 index 000000000000..5895e21457b5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/assumed_len.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! Test of the patch for PR29941, in which LEN threw an error with +! an assumed size argument. +! +! Contributed by William Mitchell +! +subroutine whatever(str) +character(len=*), dimension(*) :: str +integer :: i +i = len(str) +end subroutine whatever -- 2.47.2