This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/14959] New: [gfortran] (G95) not recognizing internal file in PURE/ELEMENATAL function


The compiler is not recognizing the internal file when in a PURE/ELEMENTAL
function.  Removing PURE/ELEMENTAL removes the error, but breaks subsequent
code.



Code:

   ELEMENTAL FUNCTION FMT_GN(N)
!  "Gn" IO Format Specifier  
   USE CHAR_UTIL, ONLY: STRIP
   INTEGER(I4B),    INTENT(IN) :: N
   CHARACTER(LEN=12)           :: FMT_GN
!  Calling Sequence:
!  N       Width of Field
!  FMT_GN  Format character string
!
   INTEGER(I4B)     :: N2
   CHARACTER(LEN=4) :: C_NUM, C_NUM2
   INTEGER          :: IOS
!
   N2 = N - 7
   WRITE(C_NUM ,'(I4)',IOSTAT=IOS) N
   WRITE(C_NUM2,'(I4)',IOSTAT=IOS) N2
   FMT_GN = '(1PG'//STRIP(C_NUM)//'.'//STRIP(C_NUM2)//')'
!
   END FUNCTION FMT_GN



Error:

tmp/g95/bin/i686-pc-linux-gnu-g95 -g  -c FG_Text_File.f90
In file FG_Text_File.f90:874
                                                                                
   WRITE(C_NUM ,'(I4)',IOSTAT=IOS) N
                                   1
Error: io-unit in WRITE statement at (1) must be an internal file in a PURE
procedure
In file FG_Text_File.f90:875
                                                                                
   WRITE(C_NUM2,'(I4)',IOSTAT=IOS) N2
                                    1
Error: io-unit in WRITE statement at (1) must be an internal file in a PURE
procedure
make: *** [FG_Text_File.o] Error 1

-- 
           Summary: [gfortran] (G95) not recognizing internal file in
                    PURE/ELEMENATAL function
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jtk at ou dot edu
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14959


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]