This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47421] New: Wrong-code: Value of scalar ALLOCATABLE CHARACTER(len=n) dummy is mangled
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 23 Jan 2011 10:47:38 +0000
- Subject: [Bug fortran/47421] New: Wrong-code: Value of scalar ALLOCATABLE CHARACTER(len=n) dummy is mangled
- Auto-submitted: auto-generated
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