* [Bug fortran/56670] Allocatable-length character var causes bogus warning with -Wall
2013-03-20 20:39 [Bug fortran/56670] New: Allocatable-length character var causes bogus warning with -Wall townsend at astro dot wisc.edu
@ 2014-03-22 15:46 ` dominiq at lps dot ens.fr
2015-08-07 20:26 ` mikael at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-03-22 15:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56670
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-03-22
Ever confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from 4.6 to trunk (4.9).
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/56670] Allocatable-length character var causes bogus warning with -Wall
2013-03-20 20:39 [Bug fortran/56670] New: Allocatable-length character var causes bogus warning with -Wall townsend at astro dot wisc.edu
2014-03-22 15:46 ` [Bug fortran/56670] " dominiq at lps dot ens.fr
@ 2015-08-07 20:26 ` mikael at gcc dot gnu.org
2021-03-26 16:51 ` [Bug fortran/56670] Allocatable-length character var causes bogus warning with -Wuninitialized msebor at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-08-07 20:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56670
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikael at gcc dot gnu.org
--- Comment #3 from Mikael Morin <mikael at gcc dot gnu.org> ---
Possibly related: PR60500
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/56670] Allocatable-length character var causes bogus warning with -Wuninitialized
2013-03-20 20:39 [Bug fortran/56670] New: Allocatable-length character var causes bogus warning with -Wall townsend at astro dot wisc.edu
2014-03-22 15:46 ` [Bug fortran/56670] " dominiq at lps dot ens.fr
2015-08-07 20:26 ` mikael at gcc dot gnu.org
@ 2021-03-26 16:51 ` msebor at gcc dot gnu.org
2021-06-10 17:19 ` johnsonsr at ornl dot gov
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-03-26 16:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56670
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.2.0, 11.0, 4.8.4, 4.9.4,
| |5.5.0, 6.4.0, 7.2.0, 8.3.0,
| |9.1.0
Last reconfirmed|2014-03-22 00:00:00 |2021-3-26
CC| |msebor at gcc dot gnu.org
--- Comment #10 from Martin Sebor <msebor at gcc dot gnu.org> ---
Reconfirming with GCC 11.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/56670] Allocatable-length character var causes bogus warning with -Wuninitialized
2013-03-20 20:39 [Bug fortran/56670] New: Allocatable-length character var causes bogus warning with -Wall townsend at astro dot wisc.edu
` (2 preceding siblings ...)
2021-03-26 16:51 ` [Bug fortran/56670] Allocatable-length character var causes bogus warning with -Wuninitialized msebor at gcc dot gnu.org
@ 2021-06-10 17:19 ` johnsonsr at ornl dot gov
2021-07-01 15:33 ` burnus at gcc dot gnu.org
2021-12-10 1:16 ` vivekrao4 at yahoo dot com
5 siblings, 0 replies; 7+ messages in thread
From: johnsonsr at ornl dot gov @ 2021-06-10 17:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56670
Seth Johnson <johnsonsr at ornl dot gov> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |johnsonsr at ornl dot gov
--- Comment #11 from Seth Johnson <johnsonsr at ornl dot gov> ---
I confirm that with both 10.2 and 8.3, the example code prints the erroneous
warning with `-O0` and works as expected (no warning) with `-O1` and higher.
```
$FC "-Wall" -O1 -c ./ftest.f90
```
```fortran
subroutine do_stuff()
character(len=*), parameter :: src = "nope"
character(len=:), allocatable :: dst
dst = src
write(*,*) dst
end subroutine
```
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/56670] Allocatable-length character var causes bogus warning with -Wuninitialized
2013-03-20 20:39 [Bug fortran/56670] New: Allocatable-length character var causes bogus warning with -Wall townsend at astro dot wisc.edu
` (3 preceding siblings ...)
2021-06-10 17:19 ` johnsonsr at ornl dot gov
@ 2021-07-01 15:33 ` burnus at gcc dot gnu.org
2021-12-10 1:16 ` vivekrao4 at yahoo dot com
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-07-01 15:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56670
--- Comment #12 from Tobias Burnus <burnus at gcc dot gnu.org> ---
character(len=:), allocatable :: aa(:)
character(len=:), pointer :: pp(:)
allocate(character(len=5) :: aa(5), pp(5))
end
gives with gfortran -Wall
1 | character(len=:), allocatable :: aa(:)
| ^
Warning: ‘.aa’ is used uninitialized [-Wuninitialized]
afoo.f90:2:34:
2 | character(len=:), pointer :: pp(:)
| ^
Warning: ‘.pp’ is used uninitialized [-Wuninitialized]
The reason is how dtype is initialized:
D.3965 = (bitsizetype) (sizetype) NON_LVALUE_EXPR <.aa> * 8;
D.3966 = (sizetype) NON_LVALUE_EXPR <.aa>;
aa.data = 0B;
aa.dtype = {.elem_len=(unsigned long) .aa, .rank=1, .type=6};
Later with the alloc, it is correctly set, i.e. it is only an issue for the
initial deallocate state; during allocate:
.aa = 5;
aa.dtype = {.elem_len=(unsigned long) .aa, .rank=1, .type=6};
=> Solution: Don't set .elem_len if the typespec is expr->ts.deferred)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/56670] Allocatable-length character var causes bogus warning with -Wuninitialized
2013-03-20 20:39 [Bug fortran/56670] New: Allocatable-length character var causes bogus warning with -Wall townsend at astro dot wisc.edu
` (4 preceding siblings ...)
2021-07-01 15:33 ` burnus at gcc dot gnu.org
@ 2021-12-10 1:16 ` vivekrao4 at yahoo dot com
5 siblings, 0 replies; 7+ messages in thread
From: vivekrao4 at yahoo dot com @ 2021-12-10 1:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56670
Vivek Rao <vivekrao4 at yahoo dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vivekrao4 at yahoo dot com
--- Comment #13 from Vivek Rao <vivekrao4 at yahoo dot com> ---
Many warnings that I think are spurious for the code
program main
implicit none
character (len=:), allocatable :: words(:)
words = ["dog","cat"]
print*,words
end program main
compiled with gfortran -Wall xalloc_char.f90
using GNU Fortran (GCC) 12.0.0 20211024 (experimental) from equation.com on
Windows gives
xalloc_char.f90:3:42:
3 | character (len=:), allocatable :: words(:)
| ^
Warning: '.words' is used uninitialized [-Wuninitialized]
xalloc_char.f90:1:12:
1 | program main
| ^
note: '.words' was declared here
xalloc_char.f90:4:21:
4 | words = ["dog","cat"]
| ^
Warning: 'words.offset' is used uninitialized [-Wuninitialized]
xalloc_char.f90:3:42:
3 | character (len=:), allocatable :: words(:)
| ^
note: 'words' declared here
xalloc_char.f90:4:21:
4 | words = ["dog","cat"]
| ^
Warning: 'words.dim[0].lbound' is used uninitialized [-Wuninitialized]
xalloc_char.f90:3:42:
3 | character (len=:), allocatable :: words(:)
| ^
note: 'words' declared here
xalloc_char.f90:4:21:
4 | words = ["dog","cat"]
| ^
Warning: 'words.dim[0].ubound' is used uninitialized [-Wuninitialized]
xalloc_char.f90:3:42:
3 | character (len=:), allocatable :: words(:)
| ^
note: 'words' declared here
xalloc_char.f90:4:21:
4 | words = ["dog","cat"]
| ^
Warning: 'words.dim[0].lbound' may be used uninitialized
[-Wmaybe-uninitialized]
xalloc_char.f90:3:42:
3 | character (len=:), allocatable :: words(:)
| ^
note: 'words' declared here
xalloc_char.f90:4:21:
4 | words = ["dog","cat"]
| ^
Warning: 'words.dim[0].ubound' may be used uninitialized
[-Wmaybe-uninitialized]
xalloc_char.f90:3:42:
3 | character (len=:), allocatable :: words(:)
| ^
note: 'words' declared here
xalloc_char.f90:4:21:
4 | words = ["dog","cat"]
| ^
Warning: 'words.dim[0].ubound' may be used uninitialized
[-Wmaybe-uninitialized]
xalloc_char.f90:3:42:
3 | character (len=:), allocatable :: words(:)
| ^
note: 'words' declared here
xalloc_char.f90:4:21:
4 | words = ["dog","cat"]
| ^
Warning: 'words.dim[0].lbound' may be used uninitialized
[-Wmaybe-uninitialized]
xalloc_char.f90:3:42:
3 | character (len=:), allocatable :: words(:)
| ^
note: 'words' declared here
^ permalink raw reply [flat|nested] 7+ messages in thread