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: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org CC: pa...@gcc.gnu.org, ja...@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