diff mbox

[Fortran,OOP] PR 60853: Failure to disambiguate generic with unlimited polymorphic

Message ID CAKwh3qgO3VVZ9EyNSrLWaJQpUnTbcN0rY_7Uzk=-ZJNw_UQ8FQ@mail.gmail.com
State New
Headers show

Commit Message

Janus Weil Nov. 25, 2016, 12:40 p.m. UTC
Hi all,

here is a patch that fixes a rejects-valid problem with an
unlimited-polymorphic variable in a generic procedure. Removing the
line with UNLIMITED_POLY fixes the error and the rest of the patch is
just slightly refactoring the for-loop.

Regtested successfully on x86_64-linux-gnu. Ok for trunk?

Cheers,
Janus


2016-11-25  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/60853
    * interface.c (gfc_compare_interfaces): Remove bad special case for
    unlimited polymorphism. Refactor for loop.

2016-11-25  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/60853
    * gfortran.dg/typebound_assignment_8.f90: New test case.

Comments

Paul Richard Thomas Nov. 25, 2016, 4:50 p.m. UTC | #1
Dear Janus,

This looks fine to me - OK for trunk.

Best regards and thanks

Paul

On 25 November 2016 at 13:40, Janus Weil <janus@gcc.gnu.org> wrote:
> Hi all,
>
> here is a patch that fixes a rejects-valid problem with an
> unlimited-polymorphic variable in a generic procedure. Removing the
> line with UNLIMITED_POLY fixes the error and the rest of the patch is
> just slightly refactoring the for-loop.
>
> Regtested successfully on x86_64-linux-gnu. Ok for trunk?
>
> Cheers,
> Janus
>
>
> 2016-11-25  Janus Weil  <janus@gcc.gnu.org>
>
>     PR fortran/60853
>     * interface.c (gfc_compare_interfaces): Remove bad special case for
>     unlimited polymorphism. Refactor for loop.
>
> 2016-11-25  Janus Weil  <janus@gcc.gnu.org>
>
>     PR fortran/60853
>     * gfortran.dg/typebound_assignment_8.f90: New test case.
Janus Weil Nov. 25, 2016, 5:23 p.m. UTC | #2
Hi Paul,

> This looks fine to me - OK for trunk.

thanks a lot. Committed as r242880.

Cheers,
Janus



> On 25 November 2016 at 13:40, Janus Weil <janus@gcc.gnu.org> wrote:
>> Hi all,
>>
>> here is a patch that fixes a rejects-valid problem with an
>> unlimited-polymorphic variable in a generic procedure. Removing the
>> line with UNLIMITED_POLY fixes the error and the rest of the patch is
>> just slightly refactoring the for-loop.
>>
>> Regtested successfully on x86_64-linux-gnu. Ok for trunk?
>>
>> Cheers,
>> Janus
>>
>>
>> 2016-11-25  Janus Weil  <janus@gcc.gnu.org>
>>
>>     PR fortran/60853
>>     * interface.c (gfc_compare_interfaces): Remove bad special case for
>>     unlimited polymorphism. Refactor for loop.
>>
>> 2016-11-25  Janus Weil  <janus@gcc.gnu.org>
>>
>>     PR fortran/60853
>>     * gfortran.dg/typebound_assignment_8.f90: New test case.
>
>
>
> --
> The difference between genius and stupidity is; genius has its limits.
>
> Albert Einstein
diff mbox

Patch

Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c	(revision 242818)
+++ gcc/fortran/interface.c	(working copy)
@@ -1728,11 +1728,9 @@  gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol
        This is also done when comparing interfaces for dummy procedures and in
        procedure pointer assignments.  */
 
-    for (;;)
+    for (; f1 || f2; f1 = f1->next, f2 = f2->next)
       {
 	/* Check existence.  */
-	if (f1 == NULL && f2 == NULL)
-	  break;
 	if (f1 == NULL || f2 == NULL)
 	  {
 	    if (errmsg != NULL)
@@ -1741,9 +1739,6 @@  gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol
 	    return 0;
 	  }
 
-	if (UNLIMITED_POLY (f1->sym))
-	  goto next;
-
 	if (strict_flag)
 	  {
 	    /* Check all characteristics.  */
@@ -1772,9 +1767,6 @@  gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol
 		return 0;
 	      }
 	  }
-next:
-	f1 = f1->next;
-	f2 = f2->next;
       }
 
   return 1;