[Bug fortran/60993] Trouble initializing double precision variable using boz literals

2015-11-16 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60993

--- Comment #4 from Dominique d'Humieres  ---
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'',Z'FFF0']
 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=  Infinitydinfp1=   0. 
 dinfn= -Infinity

With the following change

--- pr60993.f90 2014-04-29 22:32:47.0 +0200
+++ pr60993_db.f90  2015-11-16 13:26:14.0 +0100
@@ -14,7 +14,7 @@ sinfp = transfer(Z'7F80', sinfp)
print *, "sinfn=", sinfn, "  sinfp=", sinfp

dinfp = transfer(infp, dinfp) ! Works
-   dinfp1 = transfer([Z'',Z'7FF0'], dinfp1) ! Fails --- Why??
+   dinfp1 = transfer(int([Z'',Z'7FF0'],kind=4), dinfp1) ! Fails
--- Why??

print *, "dinfp=",dinfp, "   dinfp1=", dinfp1


the output is

 sinfn=-Infinity   sinfp= Infinity
 dinfp=  Infinitydinfp1=  Infinity
 dinfn= -Infinity

[Bug fortran/60993] Trouble initializing double precision variable using boz literals

2015-11-16 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60993

--- Comment #5 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Mon Nov 16 19:15:25 2015
New Revision: 230433

URL: https://gcc.gnu.org/viewcvs?rev=230433=gcc=rev
Log:
2015-11-16  Steven G. Kargl  

PR fortran/58027
PR fortran/60993
* expr.c (gfc_check_init_expr): Prevent a redundant check when a
__convert_* function was inserted into an array constructor.
(gfc_check_assign_symbol): Check for an initialization expression
when a __convert_* was inserted.

2015-11-16  Steven G. Kargl  

PR fortran/58027
PR fortran/60993
* gfortran.dg/pr58027.f90: New test.

Added:
trunk/gcc/testsuite/gfortran.dg/pr58027.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/expr.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/60993] Trouble initializing double precision variable using boz literals

2015-11-16 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60993

--- Comment #6 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Tue Nov 17 00:07:55 2015
New Revision: 230445

URL: https://gcc.gnu.org/viewcvs?rev=230445=gcc=rev
Log:
2015-11-16  Steven G. Kargl  

PR fortran/58027
PR fortran/60993
* expr.c (gfc_check_init_expr): Prevent a redundant check when a
__convert_* function was inserted into an array constructor.
(gfc_check_assign_symbol): Check for an initialization expression
when a __convert_* was inserted.

2015-11-16  Steven G. Kargl  

PR fortran/58027
PR fortran/60993
* gfortran.dg/pr58027.f90: New test.

Added:
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/pr58027.f90
Modified:
branches/gcc-5-branch/gcc/fortran/ChangeLog
branches/gcc-5-branch/gcc/fortran/expr.c
branches/gcc-5-branch/gcc/testsuite/ChangeLog

[Bug fortran/60993] Trouble initializing double precision variable using boz literals

2015-11-16 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60993

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||kargl at gcc dot gnu.org
 Resolution|--- |FIXED
   Assignee|unassigned at gcc dot gnu.org  |kargl at gcc dot gnu.org
   Target Milestone|--- |5.3

--- Comment #7 from kargl at gcc dot gnu.org ---
Fixed on trunk and 5-branch.

[Bug fortran/60993] Trouble initializing double precision variable using boz literals

2014-04-29 Thread anlauf at gmx dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60993

Harald Anlauf anlauf at gmx dot de changed:

   What|Removed |Added

 CC||anlauf at gmx dot de

--- Comment #1 from Harald Anlauf anlauf at gmx dot de ---
The ICE is not nice.

However, in the meantime you can try something like the following
as a workaround:

  real(8), parameter :: dinf = real (z'7ff8',8)
  real(8), parameter :: dnan = real (z'7ff0',8)
  write(*,*) dnan, dinf
  write(*,'(z16.16,4x,z16.16)') dnan, dinf
end

which works for me.


[Bug fortran/60993] Trouble initializing double precision variable using boz literals

2014-04-29 Thread fkrogh#gcc at mathalacarte dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60993

--- Comment #2 from Fred Krogh fkrogh#gcc at mathalacarte dot com ---
Thanks for the suggestion.  As a result of another suggestion, I'm using
 -fno-range-check and defining infinity as 1.0d0/0.0d0.


[Bug fortran/60993] Trouble initializing double precision variable using boz literals

2014-04-29 Thread dominiq at lps dot ens.fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60993

Dominique d'Humieres dominiq at lps dot ens.fr changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2014-04-29
 Ever confirmed|0   |1

--- Comment #3 from Dominique d'Humieres dominiq at lps dot ens.fr ---
 The ICE is not nice.

Seems related to pr59910.