https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100551

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
(In reply to Martin Liška from comment #1)
> Started with r11-6928-g4225af228b5d52e8.

The partial revert:

diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index cce18d094a6..91efb67ac87 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -5826,7 +5826,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
                                     &derived_array);
        }
       else if (UNLIMITED_POLY (fsym) && e->ts.type != BT_CLASS
-              && gfc_expr_attr (e).flavor != FL_PROCEDURE)
+//            && gfc_expr_attr (e).flavor != FL_PROCEDURE)
+              )
        {
          /* The intrinsic type needs to be converted to a temporary
             CLASS object for the unlimited polymorphic formal.  */

fixes this issue but breaks testcase proc_ptr_52.f90.

Further reduced testcase for this PR:

program p
  implicit none
  integer :: result
  result = 1
! result = test (    (result)) ! works
  result = test (int (result)) ! fails
  write(*,*) result
contains
  integer function test(x)
    class(*), intent(in) :: x
    select type (x)
    type is (integer)
       test = x
    class default
       test = -1
    end select
  end function test
end program

Reply via email to