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

[feature request] please improve error message for procedure pointer missing nopass attribute

Kacper_Kowalik
Beginner
1,078 Views

Hi,

I find pass/nopass kind of error quite confusing, please consider following code:

program foo
  implicit none

  interface
    subroutine foo_P(dummy)
      implicit none
      real, intent(in) :: dummy
    end subroutine foo_P
  end interface

  type :: foo_T
    procedure(foo_P), pointer :: func
  end type
end program foo

Procedure pointer func in type foo_T is obviously missing nopass attribute. This is what ifort reports:

foo.f90(5): error #8262: The passed-object dummy argument must be dummy data object with the same declared type as the type being defined. [DUMMY]
subroutine foo_P(dummy)
-----------------------^
compilation aborted for foo.f90 (code 1)

It took me quite a while to find the actual cause. To compare that's the output of gfortran-4.6:

foo.f90:12.39:
procedure(foo_P), pointer :: func
                             1
Error: Argument 'dummy' of 'func' with PASS(dummy) at (1) must be of the derived type 'foo_t'

Would it be possible to enhance the compiler logic for this case?
Best regards,
Kacper Kowalik

0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,078 Views
Thanks - I have submitted this as issue DPD200236555. Either NOPASS should be specified or a passed dummy argument should be specified.
0 Kudos
Steven_L_Intel1
Employee
1,078 Views
The error message will be improved in a future release. Thanks for the suggestion.
0 Kudos
Reply