[Bug fortran/25923] New: [gfortran] garbled diagnostics with -O -Wuninitialized
martin at mpa-garching dot mpg dot de
gcc-bugzilla@gcc.gnu.org
Mon Jan 23 12:50:00 GMT 2006
Current gfortran (mainline and 4.1 branch) appears to get quite confused when
compiling the following code with -O -Wuninitialized:
module foo
implicit none
type bar
integer :: yr
integer :: mth
integer :: day
end type
contains
function baz(arg) result(res)
type(bar), intent(in) :: arg
type(bar) :: res
logical, external:: some_func
if (.not. some_func(arg)) then
call fatal('arg not valid')
else
res = arg
end if
end function baz
end module foo
~/tmp>gfortran -v -c -Wuninitialized -O bugtest.f90
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /scratch/gcc/configure --quiet
--prefix=/afs/mpa/data/martin/ugcc --enable-languages=c++,fortran
--with-gmp=/usr/local/appl/gmp-4.1.4 --enable-checking=release
Thread model: posix
gcc version 4.2.0 20060123 (experimental)
/afs/mpa/data/martin/ugcc/libexec/gcc/i686-pc-linux-gnu/4.2.0/f951 bugtest.f90
-quiet -dumpbase bugtest.f90 -mtune=generic -auxbase bugtest -O -Wuninitialized
-version -o /tmp/cchtyroB.s
GNU F95 version 4.2.0 20060123 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 4.2.0 20060123 (experimental).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
'res.daybugtest.f90: In function 'baz':
bugtest.f90:12: warning: ' may be used uninitialized in this function
'res.mthbugtest.f90:12: warning: ' may be used uninitialized in this function
'res.yrbugtest.f90:12: warning: ' may be used uninitialized in this function
as -V -Qy -o bugtest.o /tmp/cchtyroB.s
GNU assembler version 2.15 (i686-pc-linux-gnu) using BFD version 2.15
The 4.0 branch produces
~/tmp>gfortran -c -Wall -O bugtest.f90
bugtest.f90: In function 'baz':
bugtest.f90:12: warning: 'res .day ' may be used uninitialized in this
function
bugtest.f90:12: warning: 'res .mth ' may be used uninitialized in this
function
bugtest.f90:12: warning: 'res .yr ' may be used uninitialized in this
function
which looks better, but not quite right either.
--
Summary: [gfortran] garbled diagnostics with -O -Wuninitialized
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: martin at mpa-garching dot mpg dot de
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25923
More information about the Gcc-bugs
mailing list