This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] PR44646 - Add parser support for DO CONCURRENT


On Monday 05 September 2011 18:11:47 Tobias Burnus wrote:
> On 09/03/2011 02:49 PM, Tobias Burnus wrote:
> > This patch implements the parsing/diagnostic for "DO[,] CONCURRENT 
> > for-all-header", e.g.
> >
> >   do concurrent (i = 1:5)
> >     A(i) = B(i)
> >   end do
> 
> (Side remark: do concurrent also supports a logical mask expression as 
> FORALL does.)
> 
> 
> I have attached an updated version, which actually implements do 
> concurrent in trans-stmt.c. Additionally, "CYCLE" without a label did 
> not work.
> 
> > Build and regtested on x86-64-linux.
> > OK for the trunk?
Patch is basically OK. One comment below.





> diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
> index 436c160..3877711 100644
> --- a/gcc/fortran/resolve.c
> +++ b/gcc/fortran/resolve.c
> @@ -3125,11 +3126,17 @@ resolve_function (gfc_expr *expr)
>      {
>        if (forall_flag)
>         {
> -         gfc_error ("reference to non-PURE function '%s' at %L inside a "
> +         gfc_error ("Reference to non-PURE function '%s' at %L inside a "
>                      "FORALL %s", name, &expr->where,
>                      forall_flag == 2 ? "mask" : "block");
>           t = FAILURE;
>         }
> +      else if (do_concurrent_flag)
> +       {
> +         gfc_error ("Reference to non-PURE function '%s' at %L inside a "
> +                    "DO CONCURRENT block", name, &expr->where);
> +         t = FAILURE;
> +       }
You could distinguish between mask and block here, like it is done for forall 
just above, or you could decide that mask is part of the do concurrent block 
and keep the error message as is (it is more i18n/gettext friendly), in which 
case you don't need to set do_concurrent_flag to 2 (hunk below). 
I'm undecided about which is the better one.

> @@ -9083,6 +9107,11 @@ resolve_code (gfc_code *code, gfc_namespace *ns)
>               /* Blocks are handled in resolve_select_type because we have
>                  to transform the SELECT TYPE into ASSOCIATE first.  */
>               break;
> +            case EXEC_DO_CONCURRENT:
> +             do_concurrent_flag = 1;
> +             gfc_resolve_blocks (code->block, ns);
> +             do_concurrent_flag = 2;
> +             break;


Thanks for the patch

Mikael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]