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/69937] New: -Wuninitialized does not warn when an uninitialised variable is printed before use


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69937

            Bug ID: 69937
           Summary: -Wuninitialized does not warn when an uninitialised
                    variable is printed before use
           Product: gcc
           Version: 5.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kloedej at knmi dot nl
  Target Milestone: ---

Created attachment 37778
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37778&action=edit
minimal example that shows the bug

The attached example code first prints an uninitialised variable, then uses it
in an assignment, but no warning if issued for the first subroutine if the code
is compiled with:

gfortran -Wuninitialized -c warning_test.f90

on the other hand if the order is reversed (as in the second subroutine), and
the assignment comes before the write statement, a warning is issued.

This may be related to issue #34721

Software version used for testing:

GNU Fortran (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2)
running on Fedora 23.

Output of the compile command:

>gfortran -Wuninitialized -c warning_test.f90
warning_test.f90:16:0:

     b = a
 ^
Warning: âaâ is used uninitialized in this function [-Wuninitialized]
>

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