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

--- Comment #8 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Mon, May 20, 2019 at 05:24:42AM +0000, tkoenig at gcc dot gnu.org wrote:
> Hi Steve,
> 
> the same thing also happens if the variables are declared as
> integer(kind=1), as I found yesterday, also on assignment to
> a default kind integer constant.
> 
> I do not think it is intended that -Wconversion should warn for that.
> 

The warning is correct.  When I fixed BOZ years ago I
made it conform to the Fortran 95 standard where a 
BOZ can only appear in a DATA statement.  In that scenario,
a BOZ is converted to an integer with the largest range.
For OP that is INTEGER(16), the conversion is only checking
whether an INTEGER(16) is being converted to an INTEGER(1).
The conversion check does not check the actual value (, because
there may not be a value).  The warning contains the hedge
word "possibly" as in the compiler isn't sure if there is a
problem but the programmer should be aware of the issue.

To be clear, 

program foo
  integer(1) i
  data i /z'89'/
  print *, i
end progran foo

issues an error because z'89' is 137 in INTEGER(16), which is
out of range and generates an error.

OP then tries z'09' or some such value.  While z'09' is 9 
and within the range of INTEGER(1), the check isn't on the
value it is on the type.

If OP doesn't like warnings, then he can add -w to the
command line to disable warnings.  Yes, I saw that OP
mentions something about mpif90.  So what?  If mpif90
does not honor -w , then that isn't gfortran's problems.


If I find time, I hope to add a gfc_deprecated() function
that is similar to gfc_warning() except gfc_deprecated()
cannot be silenced.  For OP's program, one would get
something like

    byte b
    ^
    DEPRECATED:  BYTE type is deprecated in gfortran 10 and 
    subject for removal in gfortran 11.

This gives users at least 2 years to fix their broke code.

If I don't find the time, when I fix BOZ to conform with
F2018, I'll simply remove the extensions that apply to a
BOZ.

Reply via email to