PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Bounds Checking Problem with F90 6.1 -- 5.2 Works

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



Joined: 19 May 2006
Posts: 9

PostPosted: Wed May 24, 2006 6:51 am    Post subject: Bounds Checking Problem with F90 6.1 -- 5.2 Works Reply with quote

I have an F90 code that won't run with the 6.1 bounds checking turned on. The code runs OK with pgf90 v5.2 with and without bounds checking. It also runs OK with the 6.1 compiler without bounds checking. With bounds checking turned on and the v6.1 compiler, I get a run-time error message:

0: Subscript out of range for array x (arraytest.f: 61)
subscript=25, lower bound=0, upper bound=24, dimension=1

The code is

45: REAL, POINTER :: x(:,:)

60: do i = 1, size(x,1)
61: write(6,*)'Element ', i, ':', x(i,1)
62: end do

The output using 5.2 and 6.1 without bounds checking is identical. The platform is Linux and I'm using the 64-bit compiler.

Thanks,

Bill
Back to top
View user's profile
mkcolg



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

PostPosted: Wed May 24, 2006 3:04 pm    Post subject: Reply with quote

Hi Bill,

I suspect you have the lower bound of x specified as 0. If this is the case, then you'll need to adjust your do loops indices to match your array's upper and lower bounds. If this isn't it, can you post more of the code, including how x is allocated, or send a copy to trs@progup.com?

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



Joined: 19 May 2006
Posts: 9

PostPosted: Tue May 30, 2006 12:08 pm    Post subject: Code Reply with quote

I get the following error when I compile with bounds checking (pgf90 -Mbounds -o demo arraytest.f)

0: Subscript out of range for array x (arraytest.f: 48)
subscript=25, lower bound=0, upper bound=24, dimension=1

It works without bounds checking (pgf90 -o demo arraytest.f)

Here's the code:

PROGRAM arraytest

IMPLICIT none

INTEGER i, j, k, ms, mm, mg
PARAMETER (ms = 31 , mm = 25, mg = 8)

INTERFACE
SUBROUTINE arraywrite(zx)
REAL, INTENT(INOUT) :: zx(:,:)
END SUBROUTINE
ENDINTERFACE

REAL zx(mm, ms, mg)
SAVE zx

DO i = 1, mm
DO j = 1, ms
DO k = 1, mg
zx(i,j,k) = k
END DO
END DO
END DO

DO k = 1, mg
CALL arraywrite(zx(:,:,k))
END DO

END PROGRAM

C--------------------------------------------------------------------

SUBROUTINE arraywrite(t_zx)

IMPLICIT none

REAL, POINTER :: x(:,:)
COMMON /pntrs/x
SAVE /pntrs/
INTEGER i
REAL, TARGET :: t_zx(:,:)

x => t_zx

WRITE(6,*)'Size of Array ', size(x,1), 'x ', size(x,2)

DO i = 1, size(x,1)
WRITE(6,*)'Element ', i, ':', x(i,1)
END DO

END SUBROUTINE
Back to top
View user's profile
mkcolg



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

PostPosted: Wed May 31, 2006 3:51 pm    Post subject: Reply with quote

Hi Bill,

Thank you for the example code. I'm showing that the code fails with the 6.0 to 6.1-4 releases but works with the 6.1-5 and 6.1-6 releases. However, I don't see a bug fix that specifically address is problem so have asked our compiler team to investigate what the original problems was and how it was fixed.

Note you can download the latest release HERE

Thank for your report,
Mat
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