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/83113] New: Bogus "duplicate allocatable attribute" error for submodule character function


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83113

            Bug ID: 83113
           Summary: Bogus "duplicate allocatable attribute" error for
                    submodule character function
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: werner.blokbuster at gmail dot com
  Target Milestone: ---

The code below gives the (I believe, bogus) error with gfortran 7.2:

test_suballoc.f:18:46:

         character(:), allocatable :: next_line
                                              1
Error: Duplicate ALLOCATABLE attribute specified at (1)

module mm
    implicit none
    interface
        module function next_line(lu)
            implicit none
            integer, intent(in) :: lu
            character(:), allocatable :: next_line
        end function next_line
    end interface
end module mm

submodule (mm) oo
    implicit none
contains
    module function next_line(lu)
        integer, intent(in) :: lu
        character(:), allocatable :: next_line
            next_line = 'Hello!'
    end function next_line
end submodule oo

program test_suballoc
    use mm
    implicit none
    write(*,*) next_line(3)
end program test_suballoc


If the two "character(:), allocatable" lines are replaced with "character(6)"
the code compiles and runs as expected.

WB

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