- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Intel Fortran Compiler users,
I would like to know whether the following code snippet
module overwrite
type madre
contains
procedure :: sum => sum_madres
generic :: operator(+) => sum
end type madre
type, extends(madre) :: hijo
contains
procedure :: sum => sum_hijos_compliant
end type hijo
contains
function sum_madres(op1,op2) result(res)
implicit none
class(madre), intent(in) :: op1, op2
class(madre), pointer :: res
write(*,*) 'sum_madres'
end function sum_madres
function sum_hijos_compliant(op1,op2) result(res)
implicit none
class(hijo) , intent(in) :: op1
class(madre), intent(in) :: op2
class(madre), pointer :: res
write(*,*) 'sum_hijos'
end function
end module overwrite
program drive_ovw
use overwrite
implicit none
type(madre) :: m1, m2
type(hijo) :: h1, h2
class(madre), pointer :: hres
hres => h1 + m2
end program drive_ovw
should output 'sum_hijos' or 'sum_madres'. With the Intel and GFORTRAN compilers I get 'sum_madres', while with the IBM XLF compiler I get 'sum_hijos'.
I have already reported this same query in the following forum:
https://groups.google.com/forum/#!topic/comp.lang.fortran/aFNK3FXqTUA
and one very related here:
https://gcc.gnu.org/ml/fortran/2014-10/msg00124.html
with no clear answer yet.
Thanks in advance.
Best regards,
Alberto.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Related discussion in https://software.intel.com/en-us/forums/topic/534779
I will also look at this one, though my original impulse is to say that 'sum_hijos' would be correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, Alberto, for posting your query here.
As mentioned by Steve and as I posted at the comp.lang.fortran thread, "sum_hijos" appears to be the correct response. I look forward to the discussion!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Maybe you should take a look at my post here : https://software.intel.com/en-us/forums/topic/534286 where i report the same problem along with addition binding to the operator.
As I stated in my post, and is the situation for you , if you replace the operator + by a call to the function sum, you get the right_answer sum_hijos.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a problem we're already working on - our issue ID is DPD200362489. I will update this thread about any progress.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve Lionel (Intel) wrote:
This is a problem we're already working on - our issue ID is DPD200362489. I will update this thread about any progress.
Steve,
I read this is as "confirmation" from you and Intel the code in the original post is consistent with the Fortran 2003 standard and that "sum_hijos" is indeed the right response. Please correct me if I'm mistaken.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This problem is fixed in the 16.0 compiler, available now.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page