Hi Bernhard,

On 08/28/19 20:57, Bernhard Reutner-Fischer wrote:
> I see that you copied the unfortunate error-message "commence a loop"
> and i see that i completely forgot to adjust it as per Mike's
> preference in
>  https://gcc.gnu.org/ml/fortran/2015-05/msg00166.html
>
> So can you please change your new errors (and the unroll error message
> too) to something like the suggested
> "directive not at the start of a loop at %C" please?
>
> Many thanks in advance!
> PS: This is border obvious, i'd send the patch for review anyway,
> maybe a native speaker can provide a better wording.

see attachment and below for Changelog.  Regtested OK.

I have opted for the variant "directive not at the start of a loop",
which is what Mike preferred, and what matches the current capabilities.

Is that OK?

> PPS: I'm still a bit unhappy about the following kludges in unroll even
> more so since you copied the concept:
> (1) The globals to diagnose misplaced directives are very ugly.
> (2) putting the payload into gfc_iterator is ugly, too. I don't
> remember offhand how ugly or intrusive it would be to provide means for
> passing down an additional optional structure to act as sink for the
> directive payload data. Putting those into the iterator is AFAIR not
> all that clean. Maybe you could have a look if you can extend this area
> to look less clumsy? "hinted_iterator" maybe, or maybe the iterator is
> seldomly used anyway and hence we don't care?

Could you please open a new PR for this?

There are many things that could be improved in this context.
There is a lot that could be learned from e.g. the Cray or NEC
compilers, where you can explicitly control loop fusion, loop
blocking, which are very important in (my) practice.

The current implementation also does not support array notation,
which I consider a major limitation.  I'll have to learn how this
could be done.

> thanks and cheers,
>

Thanks for the feedback!

Harald

2019-08-28  Harald Anlauf  <anl...@gmx.de>

        PR fortran/91496
        * parse.c (parse_executable): Improve error messages for
        improperly placed pragmas not preceeding a loop.

2019-08-28  Harald Anlauf  <anl...@gmx.de>

        PR fortran/91496
        * gfortran.dg/directive_unroll_5.f90: Adjust error message.

Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c (revision 274998)
+++ gcc/fortran/parse.c (working copy)
@@ -5454,16 +5454,17 @@
        }

       if (directive_unroll != -1)
-       gfc_error ("%<GCC unroll%> directive does not commence a loop at %C");
+       gfc_error ("%<GCC unroll%> directive not at the start of a loop at %C");

       if (directive_ivdep)
-       gfc_error ("%<GCC ivdep%> directive does not commence a loop at %C");
+       gfc_error ("%<GCC ivdep%> directive not at the start of a loop at %C");

       if (directive_vector)
-       gfc_error ("%<GCC vector%> directive does not commence a loop at %C");
+       gfc_error ("%<GCC vector%> directive not at the start of a loop at %C");

       if (directive_novector)
-       gfc_error ("%<GCC novector%> directive does not commence a loop at %C");
+       gfc_error ("%<GCC novector%> "
+                  "directive not at the start of a loop at %C");

       st = next_statement ();
     }
Index: gcc/testsuite/gfortran.dg/directive_unroll_5.f90
===================================================================
--- gcc/testsuite/gfortran.dg/directive_unroll_5.f90    (revision 274998)
+++ gcc/testsuite/gfortran.dg/directive_unroll_5.f90    (working copy)
@@ -31,7 +31,7 @@
   integer :: a(n), b(n)
   integer (kind=4) :: i
 !GCC$ unroll 8
-  write (*,*) "wrong"! { dg-error "directive does not commence a loop" }
+  write (*,*) "wrong"! { dg-error "directive not at the start of a loop" }
   DO i=n, 1, -1
     call dummy2(a(i), b(i), i)
   ENDDO

Reply via email to