[Bug fortran/60993] Trouble initializing double precision variable using boz literals
dominiq at lps dot ens.fr
gcc-bugzilla@gcc.gnu.org
Mon Nov 16 12:31:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60993
--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
With the patch at https://gcc.gnu.org/ml/fortran/2015-11/msg00093.html,
compiling the test gives the error
pr60993.f90:7:45:
integer, parameter :: infn(2) = [Z'00000000',Z'FFF00000']
1
Error: Arithmetic overflow converting INTEGER(16) to INTEGER(4) at (1). This
check can be disabled with the option '-fno-range-check'
The test compiles with the suggested option '-fno-range-check', but the output
is
sinfn= -Infinity sinfp= Infinity
dinfp= Infinity dinfp1= 0.0000000000000000
dinfn= -Infinity
With the following change
--- pr60993.f90 2014-04-29 22:32:47.000000000 +0200
+++ pr60993_db.f90 2015-11-16 13:26:14.000000000 +0100
@@ -14,7 +14,7 @@ sinfp = transfer(Z'7F800000', sinfp)
print *, "sinfn=", sinfn, " sinfp=", sinfp
dinfp = transfer(infp, dinfp) ! Works
- dinfp1 = transfer([Z'00000000',Z'7FF00000'], dinfp1) ! Fails --- Why??
+ dinfp1 = transfer(int([Z'00000000',Z'7FF00000'],kind=4), dinfp1) ! Fails
--- Why??
print *, "dinfp=",dinfp, " dinfp1=", dinfp1
the output is
sinfn= -Infinity sinfp= Infinity
dinfp= Infinity dinfp1= Infinity
dinfn= -Infinity
More information about the Gcc-bugs
mailing list