public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/63867] New: LEN is lost for a CHARACTER variable inside SELECT TYPE
@ 2014-11-14 11:42 mrestelli at gmail dot com
  2014-11-14 11:48 ` [Bug fortran/63867] " mrestelli at gmail dot com
  2014-11-30 11:55 ` dominiq at lps dot ens.fr
  0 siblings, 2 replies; 3+ messages in thread
From: mrestelli at gmail dot com @ 2014-11-14 11:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63867

            Bug ID: 63867
           Summary: LEN is lost for a CHARACTER variable inside SELECT
                    TYPE
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mrestelli at gmail dot com

Consider the following code:

program p
 implicit none

 character(len=5) :: str

 str = 'abcde'
 call checklen1(str)
 call checklen2(str)

contains

 subroutine checklen1(s)
  character(len=*), intent(in) :: s

   call checklen2(s)

 end subroutine checklen1

 subroutine checklen2(s)
  class(*), intent(in) :: s

   select type(s)
    type is(character(len=*))
     write(*,*) "Len is ",len(s)
     write(*,*) "s is   ",s
   end select

 end subroutine checklen2

end program p


When compiled with gfortran it prints

$ ./test
 Len is            0
 s is   
 Len is            5
 s is   abcde

while the expected output is twice the same, i.e.

$ ./test
 Len is            5
 s is   abcde
 Len is            5
 s is   abcde


I.e., inside the SELECT TYPE the lenght of the string is lost, but
only when the actual argument is itself a dummy argument with LEN=* .


 $ gfortran --version
GNU Fortran (GCC) 5.0.0 20141114 (experimental)


Marco


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-30 11:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-14 11:42 [Bug fortran/63867] New: LEN is lost for a CHARACTER variable inside SELECT TYPE mrestelli at gmail dot com
2014-11-14 11:48 ` [Bug fortran/63867] " mrestelli at gmail dot com
2014-11-30 11:55 ` dominiq at lps dot ens.fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).