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

A problem with CLASS(*), POINTER and ASSOCIATE

FortranFan
Honored Contributor II
320 Views

Using compiler 15, update 3, I would expect the following simple code should generate a compiler error with the use of an associate-name x without select-type construct; note x is associated with an unlimited polymorphic pointer.  Instead, no compiler errors and warnings are generated.  At run-time, no exception occurs but nothing is printed for x for the statement on line 10.

program p

   implicit none

   class(*), pointer :: ptr

   allocate( ptr, source=1 )

   asc: associate ( x => ptr )
      print *, " x = ", x
   end associate asc

   deallocate(ptr)

   stop

end program p

 

0 Kudos
3 Replies
Steven_L_Intel1
Employee
320 Views

Right you are. Since the selector is polymorphic, the associate-name is also. (But the associate-name, X, isn't a pointer - it does have TARGET.) As X is polymorphic, one must reference it within a SELECT TYPE construct.

Escalated as issue DPD200370511.

And with this, I'm officially on vacation. My colleagues will, I hope, take good care of you. See you in a couple of weeks.

0 Kudos
FortranFan
Honored Contributor II
320 Views

Thanks, Steve.  Have a wonderful and safe vacation!

0 Kudos
Steven_L_Intel1
Employee
320 Views

I expect this to be fixed in Update 2 (probably early February).

0 Kudos
Reply