Bug 31731 - False warning for variable used in 'automatic' implied do loop
Summary: False warning for variable used in 'automatic' implied do loop
Status: RESOLVED DUPLICATE of bug 29458
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-27 21:16 UTC by tjf
Modified: 2007-04-27 22:18 UTC (History)
2 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tjf 2007-04-27 21:16:57 UTC
This is not bug 5035.

[tjf@fkpc167 Bug2]$ cat bb.f90 

subroutine SetupRadii(N)
integer,intent(in)::N
integer::i,j
write(*,*)(/(i,i=1,N)/)
write(*,*)(/(j,j=1,5)/)
end subroutine SetupRadii

[tjf@fkpc167 Bug2]$ gfortran -Wall -O1 -v -c bb.f90
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --disable-multilib --enable-languages=fortran
Thread model: posix
gcc version 4.2.0 20070228 (prerelease)
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/f951 bb.f90 -quiet -dumpbase bb.f90 -mtune=generic -auxbase bb -O1 -Wall -version -I /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/finclude -o /tmp/cc30FF7z.s
GNU F95 version 4.2.0 20070228 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.2.0 20070228 (prerelease).
GGC heuristics: --param ggc-min-expand=89 --param ggc-min-heapsize=112046
bb.f90: In function ‘setupradii’:
bb.f90:5: warning: ‘i’ is used uninitialized in this function
 as --traditional-format -V -Qy -o bb.o /tmp/cc30FF7z.s
GNU assembler version 2.17 (x86_64-linux-gnu) using BFD version 2.17 Debian GNU/Linux



For those that missed it:
bb.f90: In function ‘setupradii’:
bb.f90:5: warning: ‘i’ is used uninitialized in this function

It seems that whatever generates this warning is not fully aware of implied do constructs.  Note that no warning is generated for j, for which the bounds are known at compile time.  The warning is still generated when N is a local variable rather than an argument.

I haven't tried with gcc younger than my two month old build.
Comment 1 kargls 2007-04-27 22:18:02 UTC

*** This bug has been marked as a duplicate of 29458 ***