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

Parameterized derived type: problem with ASSOCIATE construct.

FortranFan
名誉分销商 III
1,056 次查看
module m

   implicit none

   private

   type, public :: t(n)
      private
      integer, len :: n = 1
      integer :: m_a(n)
   end type t

   public :: init 
   
contains

   subroutine init(this)

      type(t(*)), intent(inout) :: this

      asc: associate ( a => this%m_a )

         a = 1

      end associate asc

      print *, " with associate: t%a = ", this%m_a

      return

   end subroutine init

end module m
program p

   use m, only : t, init

   type(t(n=2)) :: foo

   call init(foo)

   stop

end program p

 

Upon execution with either IA-32 or Intel(R) 64 compiler version:

  with associate: t%a =  0 0
Press any key to continue . . .

 

0 项奖励
8 回复数
FortranFan
名誉分销商 III
1,056 次查看

Same issue exists with a parameterized derived type with a type-bound procedure:

module m

   implicit none

   private

   type, public :: t(n)
      private
      integer, len :: n = 1
      integer :: m_a(n)
   contains
      private
      procedure, pass(this), public :: init => init_t
   end type t

contains

   subroutine init_t(this)

      class(t(*)), intent(inout) :: this

      asc: associate ( a => this%m_a )

         a = 1

      end associate asc

      print *, " with associate: t%a = ", this%m_a

      return

   end subroutine init_t

end module m
program p

   use m, only : t

   type(t(n=2)) :: foo

   call foo%init()

   stop

end program p

 

  with associate: t%a =  0 0
Press any key to continue . . .

 

0 项奖励
Steven_L_Intel1
1,056 次查看

This may be one we've already seen, but I'll check it out on Monday.

0 项奖励
andrew_4619
名誉分销商 III
1,056 次查看

I must say I do not use PDTs at the moment but can see that have some useful function. I have to say FortranFan you are doing a fantastic job in giving PDTs (and other new features) in Ifort a severe beasting and perhaps in a release or two's time I might risk dipping my toes in the water when the sharks have been cleared out.  :-)

 

0 项奖励
FortranFan
名誉分销商 III
1,056 次查看

app4619 wrote:

I must say I do not use PDTs at the moment but can see that have some useful function. I have to say FortranFan you are doing a fantastic job in giving PDTs (and other new features) in Ifort a severe beasting and perhaps in a release or two's time I might risk dipping my toes in the water when the sharks have been cleared out.  :-)

 

Thanks, I surely hope Intel doesn't mind all the posts that lead to Steve et al. having to submit tracking incidents! :-)

Re: your plan to wait until the bugs are ironed out, with PDTs yes there are a lot of issues in the current compiler version, so one has no option but to wait for a robust implementation.  But with the other features in Fortran 2003 and 2008 standards, if you do intent to use them in the near future in new code or in upgrade of your existing code, it may makes sense to start dabbling now and put together small cases that mimic your code design patterns.  I've found this firms up my understanding while also identifying any compiler issues earlier on in the code development cycle.

Now with PDTs, I do think they hold a lot of value and Intel can no sooner improve their implementation for users to start appreciating the benefits.

0 项奖励
Steven_L_Intel1
1,056 次查看

The developers do suggest that I go on vacation more often, though this just bunches up the reports.... We do appreciate the bug reports and are interested in strengthening the PDT support as soon as we can. We have already made great strides, thanks to past reports from you and others.

0 项奖励
Steven_L_Intel1
1,056 次查看

Issue ID is DPD200367383.

0 项奖励
FortranFan
名誉分销商 III
1,056 次查看

Thanks Steve, you deserve all the vacation you desire!  But our hope is you only "hang up your boots" after all the computing is done and the world is in nirvana!! :-))

0 项奖励
Steven_L_Intel1
1,056 次查看

Well, this year you'll be without me for quite a bit, so get those bugs in early. (My colleagues will try to fill in...)

0 项奖励
回复