public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mailling-lists-bd at posteo dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/77504] [9/10/11/12 Regression] "is used uninitialized" with allocatable string and array constructors Date: Mon, 17 Jan 2022 14:24:44 +0000 [thread overview] Message-ID: <bug-77504-4-sb9fUjV4UH@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-77504-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77504 Baptiste Demoulin <mailling-lists-bd at posteo dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mailling-lists-bd at posteo dot de --- Comment #27 from Baptiste Demoulin <mailling-lists-bd at posteo dot de> --- I don't know if it is related to this bug, but I found that this program: program test_allocatable implicit none integer, allocatable :: array(:) character(len=:), allocatable :: string integer :: i character(len=64) :: buf allocate(array(4)) array = [1, 2, 3, 4] do i=1, size(array) - 1 write(buf, '(I0)') array(i) string = string//trim(buf)//',' end do write(buf, '(I0)') array(size(array)) string = string//trim(buf) write(*, '(A)') string end program test_allocatable yields: gfortran -Wuninitialized allocatable_string.f90 allocatable_string.f90:20:28: 20 | string = string//trim(buf) | ^ Warning: ‘.__var_2_realloc_string’ may be used uninitialized [-Wmaybe-uninitialized] If the line "string = string//trim(buf)" after the loop is commented, then the warning disppears. The test was run on Fedora, where "gfortran --version" yields: GNU Fortran (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
next prev parent reply other threads:[~2022-01-17 14:24 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-77504-4@http.gcc.gnu.org/bugzilla/> 2020-07-24 14:45 ` [Bug fortran/77504] [8/9/10/11 " dev-zero at gentoo dot org 2020-07-24 15:57 ` kargl at gcc dot gnu.org 2020-07-24 16:47 ` tkoenig at gcc dot gnu.org 2020-07-24 17:20 ` kargl at gcc dot gnu.org 2020-07-27 12:43 ` dev-zero at gentoo dot org 2021-03-31 22:50 ` msebor at gcc dot gnu.org 2021-05-14 9:48 ` [Bug fortran/77504] [9/10/11/12 " jakub at gcc dot gnu.org 2021-06-01 8:08 ` rguenth at gcc dot gnu.org 2022-01-17 14:24 ` mailling-lists-bd at posteo dot de [this message] 2022-05-27 9:36 ` [Bug fortran/77504] [10/11/12/13 " rguenth at gcc dot gnu.org 2022-06-28 10:32 ` jakub at gcc dot gnu.org 2023-07-07 10:31 ` [Bug fortran/77504] [11/12/13/14 " rguenth at gcc dot gnu.org 2024-02-23 19:15 ` w6ws at earthlink dot net 2024-02-23 20:16 ` kargl at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-77504-4-sb9fUjV4UH@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).