[Bug fortran/50334] New: interaction between -Wuninitialized and -finit-real=snan
arnaud02 at users dot sourceforge.net
gcc-bugzilla@gcc.gnu.org
Thu Sep 8 16:27:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50334
Bug #: 50334
Summary: interaction between -Wuninitialized and
-finit-real=snan
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: arnaud02@users.sourceforge.net
Considering
subroutine qq(aa)
aa = bb + 1 ! bb unset
end subroutine
>gfortran461 -O3 -Wuninitialized -c qq.f
qq.f: In function 'qq':
qq.f:2:0: warning: 'bb' is used uninitialized in this function
[-Wuninitialized]
>gfortran461 -O3 -Wuninitialized -finit-real=snan -c qq.f
>
The absence of compile-time warnings in the second case surprised me for a
while until I tracked it down to "-finit-real=snan". "-finit-real=snan" is a
killer feature of gfortran, badly missing in Intel Fortran for instance. It is
somewhat regrettable that this option disables the compile-time warnings about
uninitialized variables as "snan" in this case is used to find unset variables
at run-time.
Could you at least add a note in the description of "-finit-real=" explaining
that "-finit-real=" will disable the warnings about uninitialized variables
even for "snan"?
More information about the Gcc-bugs
mailing list