From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17785 invoked by alias); 14 Nov 2014 11:42:04 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 17720 invoked by uid 48); 14 Nov 2014 11:41:59 -0000 From: "mrestelli at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/63867] New: LEN is lost for a CHARACTER variable inside SELECT TYPE Date: Fri, 14 Nov 2014 11:42:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mrestelli at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-11/txt/msg01225.txt.bz2 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