This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/50334] New: interaction between -Wuninitialized and -finit-real=snan


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"?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]