Commit 02c74373 by Francois-Xavier Coudert Committed by François-Xavier Coudert

re PR fortran/38718 (some simplifiers for elemental intrinsics missing; required…

re PR fortran/38718 (some simplifiers for elemental intrinsics missing; required for init expressions)

	PR fortran/38718

	* intrinsic.c (add_functions): Add gfc_simplify_dreal.
	* intrinsic.h (gfc_simplify_dreal): New proto.
	* simplify.c (gfc_simplify_dreal): New function.

	* gfortran.dg/initialization_29.f90: Expand test.

From-SVN: r181198
parent c5bdb340
2011-11-08 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/38718
* intrinsic.c (add_functions): Allow dreal simplification.
* intrinsic.h (gfc_simplify_dreal): New prototype.
* simplify.c (gfc_simplify_dreal): New function.
2011-11-09 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/21881
......
......@@ -1557,8 +1557,8 @@ add_functions (void)
make_generic ("dprod", GFC_ISYM_DPROD, GFC_STD_F77);
add_sym_1 ("dreal", GFC_ISYM_REAL, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd, GFC_STD_GNU,
NULL, NULL, NULL,
add_sym_1 ("dreal", GFC_ISYM_REAL, CLASS_ELEMENTAL, ACTUAL_NO,
BT_REAL, dd, GFC_STD_GNU, NULL, gfc_simplify_dreal, NULL,
a, BT_COMPLEX, dd, REQUIRED);
make_generic ("dreal", GFC_ISYM_REAL, GFC_STD_GNU);
......
......@@ -262,6 +262,7 @@ gfc_expr *gfc_simplify_digits (gfc_expr *);
gfc_expr *gfc_simplify_dim (gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_dprod (gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_dot_product (gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_dreal (gfc_expr *);
gfc_expr *gfc_simplify_dshiftl (gfc_expr *, gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_dshiftr (gfc_expr *, gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_epsilon (gfc_expr *);
......
......@@ -939,6 +939,21 @@ gfc_simplify_dint (gfc_expr *e)
gfc_expr *
gfc_simplify_dreal (gfc_expr *e)
{
gfc_expr *result = NULL;
if (e->expr_type != EXPR_CONSTANT)
return NULL;
result = gfc_get_constant_expr (BT_REAL, e->ts.kind, &e->where);
mpc_real (result->value.real, e->value.complex, GFC_RND_MODE);
return range_check (result, "DREAL");
}
gfc_expr *
gfc_simplify_anint (gfc_expr *e, gfc_expr *k)
{
gfc_expr *result;
......
2011-11-09 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/38718
* gfortran.dg/initialization_29.f90: Expand test.
2011-11-09 Dodji Seketeli <dodji@redhat.com>
PR c++/51027
......
! { dg-do compile }
!
! PR fortran/38718
!
implicit none
real(kind=8), parameter :: r = kind(0) + 0.2
complex(kind=8), parameter :: c = (r, -9.3)
integer, parameter :: k = nint(dreal(c))
integer, parameter :: l = nint(realpart(c))
integer(kind=k) :: i
integer(kind=l) :: j
i = 42
j = 42
print *, k, i, j, r
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment