public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/85547] Run-time error: character array constructor
[not found] <bug-85547-4@http.gcc.gnu.org/bugzilla/>
@ 2021-01-20 21:01 ` anlauf at gcc dot gnu.org
2023-09-06 17:34 ` anlauf at gcc dot gnu.org
1 sibling, 0 replies; 2+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-01-20 21:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85547
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #6 from anlauf at gcc dot gnu.org ---
The trim() and string concatenation are not even needed to see the string
length getting lost.
Example:
program p
implicit none
character(10) :: path = 'xyz/'
print *, len ( [ character(16) :: path ] ) ! ok
call print_string ( [ character(16) :: path ] ) ! typespec lost
contains
subroutine print_string (s)
character(*), intent(in) :: s(:)
print *, len(s), len(s)==16
end subroutine
end program
prints:
16
10 F
Inspection of the tree-dump shows that the temporary creation for the
subroutine call looks like we initially have the proper string length
after the array constructor
atmp.6.dtype = {.elem_len=16, .rank=1, .type=6};
atmp.6.dim[0].stride = 1;
atmp.6.dim[0].lbound = 0;
atmp.6.dim[0].ubound = 0;
atmp.6.span = 16;
which gets copied to the temporary
atmp.9.dtype = {.elem_len=10, .rank=1, .type=6};
atmp.9.dim[0].stride = 1;
atmp.9.dim[0].lbound = 0;
atmp.9.dim[0].ubound = 0;
atmp.9.span = 10;
I wonder where we get this from.
Besides, we actually create two temporaries in succession instead of just
one...
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/85547] Run-time error: character array constructor
[not found] <bug-85547-4@http.gcc.gnu.org/bugzilla/>
2021-01-20 21:01 ` [Bug fortran/85547] Run-time error: character array constructor anlauf at gcc dot gnu.org
@ 2023-09-06 17:34 ` anlauf at gcc dot gnu.org
1 sibling, 0 replies; 2+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-09-06 17:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85547
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mailling-lists-bd at posteo dot de
--- Comment #7 from anlauf at gcc dot gnu.org ---
*** Bug 111304 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-06 17:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-85547-4@http.gcc.gnu.org/bugzilla/>
2021-01-20 21:01 ` [Bug fortran/85547] Run-time error: character array constructor anlauf at gcc dot gnu.org
2023-09-06 17:34 ` anlauf at gcc dot gnu.org
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).