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"?
Well this is kinda of expected, since you are saying all float variables are going to be initialized with SNAN so you can detect at runtime those variables which were left uninitialized.
Changed to enhancement request. Although, I think that this should be closed as a 'Doctor, it hurts when I do this.' issue.
Document patch submitted at http://gcc.gnu.org/ml/gcc-patches/2011-11/msg01136.html
Author: fxcoudert Date: Tue Nov 8 08:11:10 2011 New Revision: 181150 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181150 Log: PR fortran/50334 * invoke.texi (-finit-*): Document interaction with -Wuninitialized. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/invoke.texi
Fixed on trunk.