mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-04 14:41:14 +08:00
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
This commit is contained in:
parent
c5bdb340d6
commit
02c74373cf
@ -1,3 +1,10 @@
|
||||
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 *);
|
||||
|
@ -938,6 +938,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)
|
||||
{
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
15
gcc/testsuite/gfortran.dg/initialization_29.f90
Normal file
15
gcc/testsuite/gfortran.dg/initialization_29.f90
Normal file
@ -0,0 +1,15 @@
|
||||
! { 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
|
Loading…
x
Reference in New Issue
Block a user