diff options
author | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-09 09:41:17 +0000 |
---|---|---|
committer | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-09 09:41:17 +0000 |
commit | 8c6700c836a0468dd958fa4285c98f560d41bb32 (patch) | |
tree | b9ffe796c165296254c21775bc6f2300920b44ef /gcc/fortran | |
parent | 34d02bfb494f7c3f138d6199cc7ace51acfbb679 (diff) | |
download | ppe42-gcc-8c6700c836a0468dd958fa4285c98f560d41bb32.tar.gz ppe42-gcc-8c6700c836a0468dd958fa4285c98f560d41bb32.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181198 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/intrinsic.c | 4 | ||||
-rw-r--r-- | gcc/fortran/intrinsic.h | 1 | ||||
-rw-r--r-- | gcc/fortran/simplify.c | 15 |
4 files changed, 25 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 96944e26ab2..1fffbc609b6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -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 diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 8f437cc05fe..38bcb273fdd 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -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); diff --git a/gcc/fortran/intrinsic.h b/gcc/fortran/intrinsic.h index e64325b99e7..bfc2455cfd2 100644 --- a/gcc/fortran/intrinsic.h +++ b/gcc/fortran/intrinsic.h @@ -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 *); diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 01071cfe138..44318261388 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -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; |