[Patch, Fortran, OOP] PR 42188: F03:C612. The leftmost part-name shall be the name of a data object

Janus Weil janus@gcc.gnu.org
Fri Dec 2 15:24:00 GMT 2016


Hi all,

another simple fix for a rather old PR. This one adds a new check, in
order to provide better error messages than just "Unclassifiable
statement".

Regtests cleanly on x86_64-linux-gnu. Ok for trunk?

Cheers,
Janus



2016-12-02  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/42188
    * primary.c (gfc_match_rvalue): Add a new check that gives better error
    messages.

2016-12-02  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/42188
    * gfortran.dg/derived_result_2.f90.f90: New test case.
-------------- next part --------------
Index: gcc/fortran/primary.c
===================================================================
--- gcc/fortran/primary.c	(revision 243176)
+++ gcc/fortran/primary.c	(working copy)
@@ -3298,6 +3298,15 @@ gfc_match_rvalue (gfc_expr **result)
       if (sym->result == NULL)
 	sym->result = sym;
 
+      gfc_gobble_whitespace ();
+      /* F08:C612.  */
+      if (gfc_peek_ascii_char() == '%')
+	{
+	  gfc_error ("The leftmost part-ref in a data-ref can not be a "
+		     "function reference at %C");
+	  m = MATCH_ERROR;
+	}
+
       m = MATCH_YES;
       break;
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: derived_result_2.f90
Type: text/x-fortran
Size: 921 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161202/f991f0e6/attachment.bin>


More information about the Fortran mailing list