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/29373] New: implicit type declaration and contained function clash


(this is a spinoff of PR29267)

schluter@pcl247:~/src/pr/29267> cat t.f90
 implicit character*32 (a-z)
  CHARACTER(len=255), DIMENSION(1,2)  :: a
  a = reshape((/ to_string(1.0) /), (/ 1, 2 /))
  print *, a
  CONTAINS
    CHARACTER(32) FUNCTION to_string(x)
      REAL, INTENT(in) :: x
      WRITE(to_string, FMT="(F6.3)") x
    END FUNCTION
END PROGRAM
schluter@pcl247:~/src/pr/29267> gfortran t.f90
 In file t.f90:6

    CHARACTER(32) FUNCTION to_string(x)
                                   1
 In file t.f90:3

  a = reshape((/ to_string(1.0) /), (/ 1, 2 /))
                         2
Error: Procedure 'to_string' at (1) has an explicit interface and must not have
attributes declared at (2)
 In file t.f90:6

    CHARACTER(32) FUNCTION to_string(x)
                         1
Error: Syntax error in data declaration at (1)
 In file t.f90:7

      REAL, INTENT(in) :: x
                          1
Error: Unexpected data declaration statement in CONTAINS section at (1)
 In file t.f90:8

      WRITE(to_string, FMT="(F6.3)") x
                    1
Error: Syntax error in WRITE statement at (1)
 In file t.f90:9

    END FUNCTION
      1
Error: Expecting END PROGRAM statement at (1)
schluter@pcl247:~/src/pr/29267>


-- 
           Summary: implicit type declaration and contained function clash
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tobi at gcc dot gnu dot org


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


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