This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] (Coarray) Fix constraint checks for LOCK_TYPE
Hello,
Two nits below...
On Thursday 18 August 2011 00:50:29 Tobias Burnus wrote:
> diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
> index 2910ab5..dc619c3 100644
> --- a/gcc/fortran/parse.c
> +++ b/gcc/fortran/parse.c
> @@ -2148,15 +2157,76 @@ endType:
[...]
> +
> + /* Check for F2008, C1302 - and recall that pointers may not be
coarrays
> + (5.3.14) and that subobjects of coarray are coarray themselves
(2.4.7),
> + unless there are nondirect [allocatable or pointer] components
> + involved (cf. 1.3.33.1 and 1.3.33.3). */
> +
> + if (pointer && !coarray && lock_type)
> + gfc_error ("Pointer component %s at %L of type LOCK_TYPE must have a"
> + "codimension or be a subcomponent of a coarray, "
> + "which is not possible as the component has the "
> + "pointer attribute", c->name, &c->loc);
I think one could drop the first "Pointer" as it is present at the end of the
sentence: `Component %s at %L of type...'
> + else if (pointer && !coarray && c->ts.type == BT_DERIVED
> + && c->ts.u.derived->attr.lock_comp)
> + gfc_error ("Pointer component %s at %L has a noncoarray subcomponent
of type "
> + "LOCK_TYPE, which must be have a codimension or be a "
> + "subcomponent of a coarray", c->name, &c->loc);
There is one verb too many -> `which must <be removed> have a codimension...'
> Thanks for reviewing the patch and for the suggestions!
>
> Attached is an updated version of the patch, I hope it is now better,
I think it is. The fact that I understand better the problem probably helps
too. ;-)
> though I think there is still room for improvement.
well, the conditions are difficult to express anyway.
>
> Changes:
> - coarray_lock_5.f90: Added subroutine test2 with several additional
> test cases
> - updated dg-error
> - parse.c's parse_derived: Add one comment, updated all error texts,
> fixed codimension -> coarray_comp bug, added missing check and split
> some of the checks into LOCK_TYPE and lock_comp.
>
> Build and regtested on x86-64-linux.
> OK - or suggestions how to improve it further?
OK with the two nits above fixed. Thanks.
Mikael