PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

procedure pointer problem

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
wdeng



Joined: 17 Oct 2012
Posts: 2

PostPosted: Wed Oct 17, 2012 8:00 am    Post subject: procedure pointer problem Reply with quote

I've got into a problem when I use procedure pointer to point to a function returning a 64-bit integer. Here is a simple code that reproduces the problem:

Code:
module ma
implicit none
integer, parameter :: ki = selected_int_kind(10)
procedure(ma_a), pointer :: ma_p => null()

contains

subroutine ma_init()
implicit none
ma_p => ma_a
end subroutine ma_init

integer(kind = ki) function ma_a()
implicit none
ma_a = 1_ki
end function ma_a

end module ma

program test
use ma
implicit none
call ma_init()
write (*, *) ma_p()
end program test


When I try to compile the above code with pgf90, I get such an error message:

PGF90-S-0155-Illegal POINTER assignment - type mismatch (test.F90: 10)
0 inform, 0 warnings, 1 severes, 0 fatal for ma_init

However, if on line 3 of the code I replace "selected_int_kind(10)" by "selected_int_kind(5)", then it compiles well and runs well.

I've tried this on both pgf90 11.3-0 and 12.5-0, both of which have this problem. I've tried gfortran from GNU, which has no such problem.

I wonder if this is a bug of pgf90 or if I missed some restriction imposed by pgf90 but not by gfortran.
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6134
Location: The Portland Group Inc.

PostPosted: Thu Oct 18, 2012 8:51 am    Post subject: Reply with quote

Hi wdeng,

I've sent this off to our engineers for further investigation (TPR#18974). It does look like a compiler issue, but I'm not sure.

To work around the problem add the "-i8" flag.

Thanks,
Mat
Back to top
View user's profile
wdeng



Joined: 17 Oct 2012
Posts: 2

PostPosted: Thu Oct 18, 2012 3:29 pm    Post subject: Reply with quote

Thank you, Mat. "-i8" does work around the problem.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group