diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2006-06-24 10:27:32 +0200 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2006-06-24 08:27:32 +0000 |
commit | 3e7cb1c7e7e243794ce291abcbc3929f8b5f65d9 (patch) | |
tree | 4e2a4565f7f0838b16d9c83b741659c08717702c /gcc/fortran | |
parent | 35157c5e558ee9e67bc2fb3529e52dcd7a31ce5d (diff) | |
download | gcc-3e7cb1c7e7e243794ce291abcbc3929f8b5f65d9.zip gcc-3e7cb1c7e7e243794ce291abcbc3929f8b5f65d9.tar.gz gcc-3e7cb1c7e7e243794ce291abcbc3929f8b5f65d9.tar.bz2 |
re PR fortran/28094 (Modulo of real(kind=10) variables doesn't work)
PR fortran/28094
* trans-intrinsic.c (gfc_conv_intrinsic_mod): Support cases where
there is no integer kind equal to the resulting real kind.
* intrinsic.c (add_functions): MODULO is not allowed as an actual
argument.
* Makefile.am: Add _mod_r10.F90 and _mod_r16.F90.
* Makefile.in: Regenerate.
* generated/_mod_r10.F90: New file.
* generated/_mod_r16.F90: New file.
From-SVN: r114961
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/intrinsic.c | 2 | ||||
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 12 |
3 files changed, 18 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3b3584c..73b8f7e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2006-06-24 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR fortran/28094 + * trans-intrinsic.c (gfc_conv_intrinsic_mod): Support cases where + there is no integer kind equal to the resulting real kind. + * intrinsic.c (add_functions): MODULO is not allowed as an actual + argument. + 2006-06-23 Steven G. Kargl <kargls@comcast.net> PR fortran/27981 diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 46c25f6..082c1b0 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1809,7 +1809,7 @@ add_functions (void) make_generic ("mod", GFC_ISYM_MOD, GFC_STD_F77); - add_sym_2 ("modulo", 1, 1, BT_REAL, di, GFC_STD_F95, + add_sym_2 ("modulo", 1, 0, BT_REAL, di, GFC_STD_F95, gfc_check_a_p, gfc_simplify_modulo, gfc_resolve_modulo, a, BT_REAL, di, REQUIRED, p, BT_REAL, di, REQUIRED); diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index b4863a0..b23fc5f 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -860,7 +860,7 @@ gfc_conv_intrinsic_mod (gfc_se * se, gfc_expr * expr, int modulo) tree test; tree test2; mpfr_t huge; - int n; + int n, ikind; arg = gfc_conv_intrinsic_function_args (se, expr); arg2 = TREE_VALUE (TREE_CHAIN (arg)); @@ -886,7 +886,13 @@ gfc_conv_intrinsic_mod (gfc_se * se, gfc_expr * expr, int modulo) /* Test if the value is too large to handle sensibly. */ gfc_set_model_kind (expr->ts.kind); mpfr_init (huge); - n = gfc_validate_kind (BT_INTEGER, expr->ts.kind, false); + n = gfc_validate_kind (BT_INTEGER, expr->ts.kind, true); + ikind = expr->ts.kind; + if (n < 0) + { + n = gfc_validate_kind (BT_INTEGER, gfc_max_integer_kind, false); + ikind = gfc_max_integer_kind; + } mpfr_set_z (huge, gfc_integer_kinds[n].huge, GFC_RND_MODE); test = gfc_conv_mpfr_to_tree (huge, expr->ts.kind); test2 = build2 (LT_EXPR, boolean_type_node, tmp, test); @@ -896,7 +902,7 @@ gfc_conv_intrinsic_mod (gfc_se * se, gfc_expr * expr, int modulo) test = build2 (GT_EXPR, boolean_type_node, tmp, test); test2 = build2 (TRUTH_AND_EXPR, boolean_type_node, test, test2); - itype = gfc_get_int_type (expr->ts.kind); + itype = gfc_get_int_type (ikind); if (modulo) tmp = build_fix_expr (&se->pre, tmp, itype, FIX_FLOOR_EXPR); else |