[Bug fortran/81509] Wrong compilation error: iand/ieor/ior + boz + -std=f2008
dominiq at lps dot ens.fr
gcc-bugzilla@gcc.gnu.org
Wed Jul 26 13:28:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81509
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P5
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-07-26
Ever confirmed|0 |1
Severity|normal |enhancement
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
(1) Work around: wrap the boz-literal-constant inside an INT, e.g.,
program p
implicit none
write(*,*) iand(int(z'1A2B3C4D' ),3), iand(8, int(z'1A2B3C4D' ))
write(*,*) ior(int(z'1A2B3C4D' ),3), ior(8, int(z'1A2B3C4D' ))
write(*,*) ieor(int(z'1A2B3C4D' ),3), ieor(8, int(z'1A2B3C4D' ))
write(*,*) iand(int(o'123456' ),4), iand(7, int(o'123456' ))
write(*,*) ior(int(o'123456' ),4), ior(7, int(o'123456' ))
write(*,*) ieor(int(o'123456' ),4), ieor(7, int(o'123456' ))
write(*,*) iand(int(b'001011101'),5), iand(6, int(b'001011101'))
write(*,*) ior(int(b'001011101'),5), ior(6, int(b'001011101'))
write(*,*) ieor(int(b'001011101'),5), ieor(6, int(b'001011101'))
end program p
(2) From
https://gcc.gnu.org/onlinedocs/gfortran/BOZ-literal-constants.html#BOZ-literal-constants
> In all other cases, the BOZ literal constant is converted to an INTEGER value with the largest decimal representation.
i.e., INTEGER(16) in 64-bit mode and INTEGER(8) in 32-bit mode. IMO it is
compatible with
> The processor shall allow the position of the leftmost nonzero bit to be
> at least z - 1, where z is the maximum value that could result from invoking
> the intrinsic function STORAGE_SIZE (13.8.175) with an argument that is
> a real or integer scalar of any kind supported by the processor.
Note that the (invalid, see pr54072) code
program p
implicit none
print *, kind(iand(b'001011101',b'101'))
print *, kind(ieor(b'001011101',b'101'))
print *, kind(ior(b'001011101',b'101'))
end program p
gives
16
16
16
in 64-bit mode, and
8
8
8
in 32-bit mode.
(3) I agree that the KIND should not be checked for boz-literal-constant.
More information about the Gcc-bugs
mailing list