PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

PGI 12.2 bug: array with variable dimension in main program

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



Joined: 19 Jun 2011
Posts: 55

PostPosted: Sat Mar 03, 2012 7:48 am    Post subject: PGI 12.2 bug: array with variable dimension in main program Reply with quote

Here is a cut down version of the example posted in http://www.pgroup.com/userforum/viewtopic.php?t=3028.

Code:
program ILLEGAL
implicit none
integer n,m,nm,i
real ,dimension(nm) :: V

n=2
m=0
nm=2*n-2-m+1
do i=1,nm
   V(i)=0
end do
end program ILLEGAL


The array V is declared with a dimension that is not a constant; the extent nm is not even defined. PGI 12.2 on Windows (32- or 64-bit) happily compiles and links the program with no error message. If the -C option is used, a run-time subscript error occurs. Otherwise, the program crashes after an access error occurs.

The program is illegal and compilation should fail. For the same test program, GFortran 4.5 says

Code:
real ,dimension(nm) :: V
                1
Error: Variable 'nm' cannot appear in the expression at (1)
kgupta.f90:4.24:

real ,dimension(nm) :: V
                        1
Error: The module or main program array 'v' at (1) must have constant shape
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Mar 05, 2012 10:30 am    Post subject: Reply with quote

Thanks mecej4. I have send a report (TPR#18513) to our compiler engineers for further investigation.

- Mat
Back to top
View user's profile
jtull



Joined: 30 Jun 2004
Posts: 445

PostPosted: Fri Nov 15, 2013 11:37 am    Post subject: 18513 - Fortran should detect illegal use of automatics Reply with quote

This has been fixed as of the 13.9 release.

thanks,
dave
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