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/47421] New: Wrong-code: Value of scalar ALLOCATABLE CHARACTER(len=n) dummy is mangled


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

           Summary: Wrong-code: Value of scalar ALLOCATABLE
                    CHARACTER(len=n) dummy is mangled
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: pault@gcc.gnu.org, janus@gcc.gnu.org


The following program outputs
  >1bcde<
  >
rather than the expected
  >1bcde<
  >1bcde<

The problem only occurs for "len=n" using "len=5" or "len=*" works. Also using
a pointer instead of an allocatable works. Or using an array instead of a
scalar.

Found when writing a test case for PR 47339 / PR 43062. Fails with GCC 4.5 and
GCC 4.6 - earlier versions did not have allocatable scalars.


implicit none
character(len=5), allocatable :: str
allocate(str)
str = '1bcde'
print '(">",a,"<")',str
call sub(str,len(str))
contains
  subroutine sub(x,n)
     integer :: n
     character(len=n), allocatable :: x
     print '(">",a,"<")', x
  end subroutine sub
end


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