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/29912] New: Gfortran: string array functions behaving incorrectly...


When running following program (fortran90) which calls a 
string array function the result seems incorrect:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 program testat
 character(len=4)   :: ctemp(2)
 character(len=512) :: temper(2)
 !
 !------------------------
 !'This is OK.'
 !------------------------
 temper(1) = 'doncaster'
 temper(2) = 'uxbridge'
 ctemp     = temper
 print*,'ctemp(1) = ',ctemp(1)
 print*,'ctemp(2) = ',ctemp(2)
 !
 !------------------------
 !'This goes a bit wrong.'
 !------------------------
 print*,' '
 ctemp = jetter(1,2)
 print*,'ctemp(1) = ',ctemp(1)
 print*,'ctemp(2) = ',ctemp(2)

 contains
   function jetter(id1,id2)
   character(len=512) :: jetter(id1:id2)
   jetter(id1) = 'doncaster'
   jetter(id2) = 'uxbridge'
   end function jetter
 end program testat
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

This was run on a suse9(x86_64) box. Compiled using
gfortran (4.3.0 20061120 (experimental)). I think
that the "ctemp = jetter" statement should truncate
the strings in the same way as the "ctemp = temper"
statement (shouldn't it?).


-- 
           Summary: Gfortran: string array functions behaving incorrectly...
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pmason at ricardo dot com
 GCC build triplet: gcc version 4.3.0 20061120 (experimental)
  GCC host triplet: suse9
GCC target triplet: x86_64-unknown-linux-gnu


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


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