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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-05-19
                 CC|                            |tkoenig at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
With your test case, I get

$ gfortran a.f90
a.f90:32:24:

   32 |         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'
$ gfortran a.f90
a.f90:32:24:

   32 |         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'
$ gfortran -fno-range-check a.f90
$ gfortran -Wall -fno-range-check a.f90
a.f90:32:24:

   32 |         byte b2 /  '89'X/
      |                        1
Warning: Conversion from 'INTEGER(16)' to 'INTEGER(1)' at (1) [-Wconversion]
a.f90:34:13:

   34 |         b1 = 6
      |             1
Warning: Conversion from 'INTEGER(4)' to 'INTEGER(1)' at (1) [-Wconversion]
a.f90:35:13:

   35 |         b2 = 7
      |             1
Warning: Conversion from 'INTEGER(4)' to 'INTEGER(1)' at (1) [-Wconversion]
$ gfortran -Wall -Wno-conversion -fno-range-check a.f90
$ 

so the compiler tells you which option causes the warning. Following
general gcc conventions, -Wno-conversion can turn this warning off.

Having said that, the fact that "b1 = 6" triggers a warning when
-fno-range-check is in effect is certainly unintentional.

Let's see.

Reply via email to