public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/110629] New: Bug in assignment of derived type with deferred length character component @ 2023-07-11 14:02 townsend at astro dot wisc.edu 2023-07-11 17:36 ` [Bug fortran/110629] " kargl at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: townsend at astro dot wisc.edu @ 2023-07-11 14:02 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110629 Bug ID: 110629 Summary: Bug in assignment of derived type with deferred length character component Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: townsend at astro dot wisc.edu Target Milestone: --- I've run into a problem with intrinsic assignment of derived types with allocatable character components. This seems to be a resurgence of PR105205, in that only the first element of the character array is copied correctly; the rest is filled with garbage. Here's a demo: -- module m type :: bar_t character(:), allocatable :: c(:) end type bar_t end module m program p use m implicit none type(bar_t) :: bar type(bar_t) :: biz integer :: i allocate(character(10)::bar%c(3)) bar%c(1) = 'big' bar%c(2) = 'red' bar%c(3) = 'dog' biz = bar do i = 1, 3 print *, i, '|'//biz%c(i)//'|' end do end program p -- Output compiling with gfortran 12.2.0 on MacOS 13.4: 1 |big | 2 |>| 3 || Unfortunately, this may be a heisenbug -- some code where I do this kind of assignment is affected, other code is not. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/110629] Bug in assignment of derived type with deferred length character component 2023-07-11 14:02 [Bug fortran/110629] New: Bug in assignment of derived type with deferred length character component townsend at astro dot wisc.edu @ 2023-07-11 17:36 ` kargl at gcc dot gnu.org 2023-07-11 17:47 ` anlauf at gcc dot gnu.org 2023-07-12 0:18 ` townsend at astro dot wisc.edu 2 siblings, 0 replies; 4+ messages in thread From: kargl at gcc dot gnu.org @ 2023-07-11 17:36 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110629 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org Priority|P3 |P4 --- Comment #1 from kargl at gcc dot gnu.org --- Thanks for the bug report. This seems to have been fixed in trunk. I don't have gfortran 13.1 installed so cannot test. % gfcx -o z a.f90 && ./z 1 |big | 2 |red | 3 |dog | % gfcx -o z -O a.f90 && ./z 1 |big | 2 |red | 3 |dog | % gfortran12 -o z -O a.f90 && ./z 1 |big | 2 ||big| 3 ||big|| There are a few Changelog entries over the last year that mention deferred length, but it's unclear which one might have fixed the issue. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/110629] Bug in assignment of derived type with deferred length character component 2023-07-11 14:02 [Bug fortran/110629] New: Bug in assignment of derived type with deferred length character component townsend at astro dot wisc.edu 2023-07-11 17:36 ` [Bug fortran/110629] " kargl at gcc dot gnu.org @ 2023-07-11 17:47 ` anlauf at gcc dot gnu.org 2023-07-12 0:18 ` townsend at astro dot wisc.edu 2 siblings, 0 replies; 4+ messages in thread From: anlauf at gcc dot gnu.org @ 2023-07-11 17:47 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110629 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work| |13.2.0 --- Comment #2 from anlauf at gcc dot gnu.org --- 13-branch is also ok. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/110629] Bug in assignment of derived type with deferred length character component 2023-07-11 14:02 [Bug fortran/110629] New: Bug in assignment of derived type with deferred length character component townsend at astro dot wisc.edu 2023-07-11 17:36 ` [Bug fortran/110629] " kargl at gcc dot gnu.org 2023-07-11 17:47 ` anlauf at gcc dot gnu.org @ 2023-07-12 0:18 ` townsend at astro dot wisc.edu 2 siblings, 0 replies; 4+ messages in thread From: townsend at astro dot wisc.edu @ 2023-07-12 0:18 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110629 --- Comment #3 from Rich Townsend <townsend at astro dot wisc.edu> --- Thanks for the quick responses, folks. The problem persists in 12.3.0 release, but is fixed in 13.1.0 release. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-12 0:18 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-07-11 14:02 [Bug fortran/110629] New: Bug in assignment of derived type with deferred length character component townsend at astro dot wisc.edu 2023-07-11 17:36 ` [Bug fortran/110629] " kargl at gcc dot gnu.org 2023-07-11 17:47 ` anlauf at gcc dot gnu.org 2023-07-12 0:18 ` townsend at astro dot wisc.edu
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).