[Bug fortran/30664] -pedantic: "Integer outside symmetric range" for integer(1) and (2) does not work
fxcoudert at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Feb 1 12:37:00 GMT 2007
------- Comment #1 from fxcoudert at gcc dot gnu dot org 2007-02-01 12:36 -------
-huge(i2)-1 is a integer(kind=4) value, because 1 is 1_4 (the default kind) and
-huge(i2) is thus promoted. You get warnings if you write it with
-huge(i2)-1_2, like in the following code:
program main
implicit none
integer(1) :: i1(3), a1(3:2)
integer(2) :: i2(3), a2(3:2)
integer(4) :: i4(3), a4(3:2)
integer(8) :: i8(3), a8(3:2)
logical :: msk(3)
msk = .false.
i1 = 1
i2 = 1
i4 = 1
i8 = 1
if(-huge(i1)-1_1 /= maxval(i1, msk)) call abort()
if(-huge(a1)-1_1 /= maxval(a1)) call abort()
if(-huge(i2)-1_2 /= maxval(i2, msk)) call abort()
if(-huge(a2)-1_2 /= maxval(a2)) call abort()
if(-huge(i4)-1_4 /= maxval(i4, msk)) call abort()
if(-huge(a4)-1_4 /= maxval(a4)) call abort()
if(-huge(i8)-1_8 /= maxval(i8, msk)) call abort()
if(-huge(a8)-1_8 /= maxval(a8)) call abort()
end program main
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30664
More information about the Gcc-bugs
mailing list