Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29249 Discussions

Incorrect results with 11.1.064 compiler

Pete_Dobreff
Beginner
652 Views
The attached code produces incorrect answers with the latest compiler - 11.1.064.

-----------------------------------------------------------------------------------------------------

module circleClass
implicit none

type circleObj
real :: radius
end type circleObj

contains

subroutine edit( circle )
class(circleObj) :: circle
write(6,*) circle%radius
end subroutine edit

end module circleClass
!
!------------------------------------------------------
!

program test

use circleClass

implicit none

class(CircleObj), allocatable :: circles(:)

allocate(circles(2))

circles(1)%radius = 1.
circles(2)%radius = 2.

call edit(circles(2))

end

-----------------------------------------------------------------------------------------------------

The correct answer should be 2.0, not 1.0 as the program produces??? Has anyone seen a similar problem?
0 Kudos
6 Replies
Kevin_D_Intel
Employee
652 Views

It is reproducible (at all opt-levels) when using CLASS(in test).Using TYPE (in test) and CLASS (in edit) produces 2.0. I may have a mis-understanding the Fortran standard for CLASS, but the usage in test appears acceptable. I'll inquire w/Development.
0 Kudos
Kevin_D_Intel
Employee
652 Views

Steve Lionel concurred that this appears to be a bug and noted a related post (here). I submitted this bug to Development and will keep this thread updated as I learn more. If convenient, perhaps TYPE can be used as a work around.

(Internal tracking id: DPD200148969 DPD200148818)
0 Kudos
Pete_Dobreff
Beginner
652 Views

Steve Lionel concurred that this appears to be a bug and noted a related post (here). I submitted this bug to Development and will keep this thread updated as I learn more. If convenient, perhaps TYPE can be used as a work around.

(Internal tracking id: DPD200148969)

As an aside, I ran this code on a competing f2003 compiler (NAG). It compiled with no errors and produced the CORRECT result - 2.0.
0 Kudos
Kevin_D_Intel
Employee
652 Views

Yes, our compiler got this wrong. I also noted in my earlier post the previous internal tracking id for the report you filed via Premier. We'll track the resolution under the earlier id. Thanks again for the convenience reproducer.
0 Kudos
Kevin_D_Intel
Employee
652 Views
I confirmed this defect will be fixed in the upcoming 11.1 update 5 inlate January/early February.
0 Kudos
Kevin_D_Intel
Employee
652 Views
11.1 Update 5 (11.1.069 - Linux) is now available.
0 Kudos
Reply