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

            Bug ID: 90536
           Summary: Use of -fno-range-check creates warnings or errors
                    when assigning to a byte variable
           Product: gcc
           Version: 4.8.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: j.ravens.nz at gmail dot com
  Target Milestone: ---

Created attachment 46382
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46382&action=edit
6-line fortran source giving warnings/errors when assining to a byte variable

Essentially any assignment to a byte variable gives a warning or an error.  The
errors are fatal, and the warnings are too numerous to ignore (I'm getting one
warning for each byte that is initialised in a DATA statement, so that can be
many thousands of warnings).  We have used code like this since 1982 without
any problems until the Ubuntu18.04 release.

When gfortran is used to compile a simple Fortran source with the
-fno-range-check option, any byte assignment in code or data statement will
give a warning, eg :

> gfortran -Wall -fno-range-check -c gfortran_bug_report.f
gfortran_bug_report.f:33.24:

        byte b2 /  '89'X/
                        1
Warning: Possible change of value in conversion from INTEGER(16) to INTEGER(1)
at (1)

This only happens with 'gfortran -c -Wall -fno-range-check' (but when using
gfortran via mpif90, -Wall is turned on, so we can't suppress those warnings,
and there are thousands of them).

However, without  -fno-range-check, we get other, fatal, errors, so that's even
worse :

gfortran -Wall -c gfortran_bug_report.f
gfortran_bug_report.f:33.24:

        byte b2 /  '89'X/
                        1
Error: Arithmetic overflow converting INTEGER(16) to INTEGER(1) at (1). This
check can be disabled with the option -fno-range-check

Reply via email to