diff mbox

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

Message ID CAKwh3qh37C5FBAR-sfwQQOCfYmCJ4TfrGVLEmO87eaN9r6Rn+A@mail.gmail.com
State New
Headers show

Commit Message

Janus Weil Dec. 2, 2016, 3:24 p.m. UTC
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.

Comments

Steve Kargl Dec. 3, 2016, 5:01 p.m. UTC | #1
On Fri, Dec 02, 2016 at 04:24:20PM +0100, Janus Weil wrote:
> 
> 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?
> 

OK.
Janus Weil Dec. 3, 2016, 6:39 p.m. UTC | #2
2016-12-03 18:01 GMT+01:00 Steve Kargl <sgk@troutmask.apl.washington.edu>:
> On Fri, Dec 02, 2016 at 04:24:20PM +0100, Janus Weil wrote:
>>
>> 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?
>>
>
> OK.

Thanks, Steve. Committed to trunk as r243223.

Cheers,
Janus
diff mbox

Patch

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;