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/54597] New: Function can't return string without trailing spaces


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

             Bug #: 54597
           Summary: Function can't return string without trailing spaces
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dongli@lasg.iap.ac.cn


I would like to write a function that will return string without trailing
spaces, the prototype of the function is as following:

module mod

contains

    function foo()

        character(*), allocatable :: foo
        character(1000) bar

        bar = "abc"
        foo = bar

    end function foo

end module mod

program main

    use mod

    write(*, *) """", foo(), """"

end program main

The result of "gfortran" still contains trailing spaces, but "ifort" works as
expected.


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