PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

pgfortran 13.10 incorrect record mark

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



Joined: 10 May 2012
Posts: 7

PostPosted: Mon Nov 25, 2013 10:56 am    Post subject: pgfortran 13.10 incorrect record mark Reply with quote

This is an update to "pgfortran 13.7 incorrect record mark", which was given
TPR #19513.
My reproducer shows the problem has not been fixed if you use the "-byteswapio"
flag. Here it is in full.

Code:

      PROGRAM MKGRID
C
C   Illustrating a problem with pgfortran 13.10 and the last record mark
C   in an unformatted file when compiling with -byteswapio.
C   Compile via: pgfortran -byteswapio mkgrid.f -o mkgrid
C   Run via: mkgrid
C   You get a file grid.in, size 224020.
C   With "od -x grid.in | head -2" I see (on a Xeon E5-2630)
C    0000000 0000 0c00 0000 3d00 0000 3300 0000 0300
C    0000020 0000 0c00 0300 f86a 0000 0000 0000 0000
C   and "od -x grid.in | tail -4" produces for me
C    0604740 0040 0000 0000 0000 0040 0000 0000 0000
C    *
C    0665420 fd00 0795
C    0665424
C
C   Note that the first record of the file contains 3 integers, so
C   12 bytes, and the record mark is accordingly 0C byte-swapped.
C   The second record of the file contains 61*51*3*3=27999 8-byte
C   reals, a total of 223992 bytes (hex 36AF8), record mark is 36AF8
C   byte-swapped. But the last record mark is not 36AF8.  This incorrect
C   record mark will cause problems with a code that uses BACKSPACE, for example.
C
C   This problem does not occur if you omit the "-byteswapio" flag.
C
C   pgfortran -V (13.10) returns:
C     pgfortran 13.10-0 64-bit target on x86-64 Linux -tp sandybridge
C
      IMPLICIT NONE
      INTEGER, PARAMETER :: JD=61,KD=51,LD=3
C
      CALL DOIT(JD,KD,LD)
      END
C*********************************************************
      SUBROUTINE DOIT(JD,KD,LD)
      IMPLICIT NONE
      INTEGER, INTENT(IN) :: JD,KD,LD
C
      REAL(8) :: X(JD,KD,LD),Y(JD,KD,LD),Z(JD,KD,LD)
      INTEGER :: J,K,L
C
C
      DO L = 1,LD
         DO K = 1,KD
            DO J = 1,JD
               X(J,K,L)   = REAL(J-1,8)
               Y(J,K,L)   = REAL(K-1,8)
               Z(J,K,L)   = REAL(L-1,8)
            ENDDO
         ENDDO
      ENDDO
C
      OPEN(UNIT=2,FILE='grid.in',STATUS='UNKNOWN',FORM='UNFORMATTED')
      WRITE(2) JD,KD,LD
      WRITE(2) X,Y,Z
      CLOSE(UNIT=2)
C
      RETURN
      END
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Nov 25, 2013 12:03 pm    Post subject: Reply with quote

Thanks Dennis. I added TRP#19692 for this additional issue.

Best Regards,
Mat
Back to top
View user's profile
jtull



Joined: 30 Jun 2004
Posts: 438

PostPosted: Fri May 02, 2014 2:01 pm    Post subject: TPR 19692 is fixed in 14.4 Reply with quote

TPR 19692 - UF: pgfortran incorrect record mark with -Mbyteswapio
has been fixed in the current 14.4 release.

Thanks again for the original report.

regards,
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