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

            Bug ID: 94769
           Summary: Possible use of uninitialized variable num
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stefansf at linux dot ibm.com
  Target Milestone: ---

In function check_io_constraints local variable num is supposed to be
initialized by function compare_to_allowed_values. While bootstrapping GCC on
S/390 I get the following warning/error:

gcc/fortran/io.c: In function 'bool gfc_resolve_dt(gfc_code*, gfc_dt*,
locus*)':
gcc/fortran/io.c:3857:7: error: 'num' may be used uninitialized in this
function [-Werror=maybe-uninitialized]
 3857 |       if (num == 0)
      |       ^~       
gcc/fortran/io.c:3843:11: note: 'num' was declared here
 3843 |       int num;

I'm not sure whether a sensible default value for num should be 0 or 1.

Reply via email to