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.
29284 Discussions

ASSOCIATED bug with polymorphic pointers?

OP1
New Contributor III
1,153 Views

Take a look at the code below. The latest ifort (2021.13.0) and ifx (2024.2.0) do not behave consistently (and I believe that ifort may be correct here):

PROGRAM P
IMPLICIT NONE

TYPE :: T_T1
END TYPE T_T1
TYPE(T_T1), POINTER :: P1_TYPE => NULL()
CLASS(T_T1), POINTER :: P1_CLASS => NULL()

P1_CLASS => P1_TYPE
WRITE(*, *) ASSOCIATED(P1_CLASS)  ! Latest ifx returns T (incorrect)
                                  ! Latest ifort returns F (correct)

END PROGRAM P
 
0 Kudos
5 Replies
FortranFan
Honored Contributor III
1,113 Views

For whatever it's worth, I find the program response using IFORT to conform to the standard.  The response using IFX does not.

0 Kudos
Ron_Green
Moderator
1,102 Views

@OP1 @FortranFan agreed, this is a bug.  I will open a bug report with the slightly modified example:

 

PROGRAM P
IMPLICIT NONE

TYPE :: T_T1
END TYPE T_T1
TYPE(T_T1), POINTER :: P1_TYPE => NULL()
CLASS(T_T1), POINTER :: P1_CLASS => NULL()

P1_CLASS => P1_TYPE

WRITE(*, *) 'P1_CLASS => P1_TYPE !after this assigment we see...'
WRITE(*, *) 'P1_TYPE  pointer associated status is: ',ASSOCIATED(P1_TYPE)
WRITE(*, *) 'P1_CLASS pointer associated status is: ',ASSOCIATED(P1_CLASS)  
! Latest ifx returns T (incorrect)
! Latest ifort returns F (correct)

END PROGRAM P
Ron_Green
Moderator
1,088 Views

Bug ID is CMPLRLLVM-59976

0 Kudos
Ron_Green
Moderator
695 Views

we checking in a fix for this in our dev branch, so we will see this fix in the 2025.1.0 Update in March 2025 timeframe.

Ron_Green
Moderator
380 Views

The fix was released with the 2025.1.0 update.

0 Kudos
Reply