[Patch, Fortran] Add CO_BROADCAST

Dominique d'Humières dominiq@lps.ens.fr
Mon Sep 29 21:59:00 GMT 2014


Le 29 sept. 2014 à 23:56, Dominique d'Humières <dominiq@lps.ens.fr> a écrit :

> Unless there is an objection I plan to commit tomorrow the following patch with a change log:
> 
> --- ../_clean/gcc/testsuite/gfortran.dg/coarray_collectives_9.f90	2014-09-25 12:14:05.000000000 +0200
> +++ gcc/testsuite/gfortran.dg/coarray_collectives_9.f90	2014-09-29 20:23:24.000000000 +0200
> @@ -1,5 +1,5 @@
>  ! { dg-do compile }
> -! { dg-options "-fcoarray=single" }
> +! { dg-options "-fcoarray=single -fmax-errors=40" }
>  !
>  !
>  ! CO_BROADCAST/CO_REDUCE
> @@ -29,7 +29,7 @@ program test
>    call co_reduce("abc") ! { dg-error "Missing actual argument 'operator' in call to 'co_reduce'" }
>    call co_broadcast(1, source_image=1) ! { dg-error "'a' argument of 'co_broadcast' intrinsic at .1. must be a variable" }
>    call co_reduce(a=1, operator=red_f) ! { dg-error "'a' argument of 'co_reduce' intrinsic at .1. must be a variable" }
> -  call co_reduce(a=val, operator=red_f2) ! { dg-error "OPERATOR argument at (1) must be a PURE function" }
> +  call co_reduce(a=val, operator=red_f2) ! { dg-error "OPERATOR argument at \\(1\\) must be a PURE function" }
>  
>    call co_broadcast(val, source_image=[1,2]) ! { dg-error "must be a scalar" }
>    call co_broadcast(val, source_image=1.0) ! { dg-error "must be INTEGER" }
> @@ -49,14 +49,14 @@ program test
>    call co_reduce(val, red_f, stat=[1,2]) ! { dg-error "must be a scalar" }
>    call co_reduce(val, red_f, stat=1.0) ! { dg-error "must be INTEGER" }
>    call co_reduce(val, red_f, stat=1) ! { dg-error "must be a variable" }
> -  call co_reduce(val, red_f, stat=i, result_image=1) ! OK
> -  call co_reduce(val, red_f, stat=i, errmsg=errmsg, result_image=1) ! OK
> +  call co_reduce(val, red_f, stat=i, result_image=1) ! { dg-error "CO_REDUCE at \\(1\\) is not yet implemented" }
> +  call co_reduce(val, red_f, stat=i, errmsg=errmsg, result_image=1) ! { dg-error "CO_REDUCE at \\(1\\) is not yet implemented" }
>    call co_reduce(val, red_f, stat=i, errmsg=[errmsg], result_image=1) ! { dg-error "must be a scalar" }
>    call co_reduce(val, red_f, stat=i, errmsg=5, result_image=1) ! { dg-error "must be CHARACTER" }
>    call co_reduce(val, red_f, errmsg="abc") ! { dg-error "must be a variable" }
>    call co_reduce(val, red_f, stat=i8) ! { dg-error "The stat= argument at .1. must be a kind=4 integer variable" }
>    call co_reduce(val, red_f, errmsg=msg4) ! { dg-error "The errmsg= argument at .1. must be a default-kind character variable" }
>  
> -  call co_broadcasr(vec(idx), 1) ! { dg-error "Argument 'A' with INTENT\\(INOUT\\) at .1. of the intrinsic subroutine co_sum shall not have a vector subscript" }
> -  call co_reduce(vec([1,3,2]), red_f) ! { dg-error "Argument 'A' with INTENT\\(INOUT\\) at .1. of the intrinsic subroutine co_min shall not have a vector subscript" }
> +  call co_broadcast(vec(idx), 1) ! { dg-error "Argument 'A' with INTENT\\(INOUT\\) at .1. of the intrinsic subroutine co_broadcast shall not have a vector subscript" }
> +  call co_reduce(vec([1,3,2]), red_f) ! { dg-error "Argument 'A' with INTENT\\(INOUT\\) at .1. of the intrinsic subroutine co_reduce shall not have a vector subscript" }
>  end program test
> 
> Le 29 sept. 2014 à 16:31, Tobias Burnus <tobias.burnus@physik.fu-berlin.de> a écrit :
> 
>> On Mon, Sep 29, 2014 at 10:17:04AM +0200, Tobias Burnus wrote:
>>> Dominique Dhumieres wrote:
>>>> The failures for the gfortran.dg/coarray_collectives_9.f90 are fixed
>>>> with the following patch:
>>> 
>>> Looks good to me. The patch is OK with a ChangLog.
>> 
>> Actually, I missed the following part:
>> 
>> ...
>> -  call co_broadcasr(vec(idx), 1) ! { dg-error "Argument 'A' with INTENT\\(INOUT\\) at .1. of the intrinsic subroutine co_sum shall not have a vector subscript" }
>> -  call co_reduce(vec([1,3,2]), red_f) ! { dg-error "Argument 'A' with INTENT\\(INOUT\\) at .1. of the intrinsic subroutine co_min shall not have a vector subscript" }
>> +  call co_broadcasr(vec(idx), 1) ! OK?
>> ...
>> 
>> Which is not fully okay: The error message should stay - but the
>> procedure name should (...casr) should be corrected (...cast).
>> 
>> Tobias
>> 
>> 
>> PS: I think I will soon post a patch to support Fortran 2015's
>> "IMPLICIT NONE (....)" where  ... can be is an implicit-none list with
>> values TYPE and EXTERNAL.  Because a "implicit none (type, external)"
>> would have found the typo!  (Or likewise: -Wimplicit-procedure.)
> 



More information about the Gcc-patches mailing list