PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Course

Compiler problem: Generic procedures

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



Joined: 17 Jan 2011
Posts: 4

PostPosted: Mon Jan 24, 2011 6:15 am    Post subject: Compiler problem: Generic procedures Reply with quote

Hi,
as previously mentioned we are evaluating PGI Visual Fortran for porting our FEM application to CUDA. However we have some issues not related to CUDA that we need to solve:

It seems that there is a compiler error in the treatment of generic procedures, below is an example that fails with PGI fortran (11.1) but compiles with e.g. intel fortran.

Here is the code:
!
module A
private
public :: A_new

interface A_new
module procedure new
end interface A_New
contains
subroutine new( r )
real :: r

r = 5.0
end subroutine new
end module A

module AA
use A

private
public :: A_new

interface A_new
module procedure new
end interface A_New

contains
subroutine new( r, i )
integer :: i
real :: r

r = 5.0
i =6
end subroutine new
end module AA

module AAA

!use A
use AA
contains

subroutine new( r, i )
integer :: i
real :: r

call A_new( r )
call A_new( r,i )
end subroutine new
end module AAA

The error message is:
: error S0155 : Could not resolve generic procedure a_new

However, changing the general "private" statement in module A and AA to the specific "private new", the compilation returns with no error. As each module contains only one subroutine, these 2 version of the code should be identical but the compiler "believes" different.

In our code we have as a general principle that we use the "private" statement to change the default from public to private in our modules, and we think that there must be an error in the compiler or are there some compiler flags that may correct this?

Einar
Back to top
View user's profile
hongyon



Joined: 19 Jul 2004
Posts: 551

PostPosted: Wed Jan 26, 2011 2:17 pm    Post subject: Reply with quote

Hi,

A workaround for now would be in module AA

use A, only:A_new

It seems to fix the problem. We will need to investigate more on this and will let you know on this thread.

I have filed a TPR#17633.


Thank you,
Hongyon


Last edited by hongyon on Fri Jan 28, 2011 3:36 pm; edited 1 time in total
Back to top
View user's profile
sorheimen



Joined: 17 Jan 2011
Posts: 4

PostPosted: Fri Jan 28, 2011 6:20 am    Post subject: Reply with quote

Well, this fixed our simple example, but for our full code it just moved the error.
The rest of the post refers to our production code where we have a similar module structure to A,AA and AAA.

Introducing the ONLY statement in what corresponds to AA with the module procedures of A produces now a compilation error compiling AA.

It seems as though the compiler is not able to find the reference to procedures in A from AA. Removing the ONLY statement, AA will compile fine but now we have the original problem of AAA.

For now we are stuck, but hopefully this issue will be solved.
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