Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Possibly spurious error with deferred type bound procedures

MR
Beginner
368 Views
Hi,
compiling the attached code, ifort complains that

ifort -c test-add.f90 test-add.f90(36): error #8314: If the rightmost part-name is of abstract type, data-ref shall be polymorphic [ADD]
call a%assign( a%add(b) )
--------------------^
compilation aborted for test-add.f90 (code 1)

My question is whether this error is correct; in particular, all my
variables are of abstract type c_ode, so I don't see the problem. As a
note, the code compiles with gfortran.

Thank you,
Marco

[bash]module mod_m
  
 implicit none  
  
 type, abstract :: c_ode
 contains
  procedure(i_add),    deferred, pass(x) :: add
  procedure(i_assign), deferred, pass(y) :: assign
 end type c_ode
  
 abstract interface
  pure function i_add(x,y) result(z)
   import :: c_ode
   implicit none
   class(c_ode), intent(in) :: x, y
   class(c_ode), allocatable :: z
  end function i_add
 end interface

 abstract interface
  pure subroutine i_assign(y,x)
   import :: c_ode
   implicit none
   class(c_ode), intent(in)  :: x
   class(c_ode), intent(out) :: y
  end subroutine i_assign
 end interface

contains

 pure subroutine sub(a,b)
  class(c_ode), intent(in)  :: b
  class(c_ode), intent(out) :: a
 
   ! a = a+b
   call a%assign( a%add(b) )
 
 end subroutine sub
  
end module mod_m
[/bash]
0 Kudos
2 Replies
Steven_L_Intel1
Employee
368 Views
Yes, this is our bug. It's an issue we've been wrestling with for a while now as the wording in the standard seemed ambiguous. However, we've resolved that and fixed the bug - the fix should appear in an update later this year. The issue ID is DPD200170220.
0 Kudos
MR
Beginner
368 Views
OK, thank you, then I'm looking forward to seing the new version.

Marco
0 Kudos
Reply