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
* [Bug fortran/63867] LEN is lost for a CHARACTER variable inside SELECT TYPE
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 ` mrestelli at gmail dot com
2014-11-30 11:55 ` dominiq at lps dot ens.fr
1 sibling, 0 replies; 3+ messages in thread
From: mrestelli at gmail dot com @ 2014-11-14 11:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63867
--- Comment #1 from mrestelli <mrestelli at gmail dot com> ---
Also, I should add that changing
type is(character(len=*))
to
type is(character(len=:))
given an internal compiler error (anyway, the code then is invalid)
Marco
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/63867] LEN is lost for a CHARACTER variable inside SELECT TYPE
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
1 sibling, 0 replies; 3+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-11-30 11:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63867
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-11-30
Ever confirmed|0 |1
--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Present from 4.8.2 up to trunk (5.0 r218188). Compiling the test in comment 0
with 4.7.3 gives
class(*), intent(in) :: s
1
Fatal Error: Unlimited polymorphism at (1) not yet supported
> Also, I should add that changing
>
> type is(character(len=*))
>
> to
>
> type is(character(len=:))
>
> given an internal compiler error (anyway, the code then is invalid)
I don't get an ICE, but the error
pr63867_db.f90:12.23:
subroutine checklen1(s)
1
Error: Entity 's' at (1) has a deferred type parameter and requires either the
pointer or allocatable attribute
pr63867_db.f90:1.9:
program p
1
Error: TODO: Deferred character length variable at (1) cannot yet be associated
with unlimited polymorphic entities
^ 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).