Code handling the mod intrinsic seems broken
François-Xavier Coudert
fxcoudert@gmail.com
Mon Jun 27 13:37:00 GMT 2005
Hi all,
The code handling the mod intrinsic for real types (mod(x,y) where x
and y are reals) seems ill-designed. In gfc_conv_intrinsic_mod(), we
have the following code:
case BT_REAL:
/* Real values we have to do the hard way. */
arg = gfc_evaluate_now (arg, &se->pre);
arg2 = gfc_evaluate_now (arg2, &se->pre);
tmp = build2 (RDIV_EXPR, type, arg, arg2);
/* 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);
I don't fully understand the workings of this, but it seems to rely on
the fact that for every real kind (here, expr->ts.kind), there is
integer kind available (since we use this real kind in a call to
gfc_validate_kind with argument BT_INTEGER).
This assumption is not true; on i686-linux, e.g., we have real(10) and
no integer(10). This is indeed blocking me from extending support for
large real kinds (I'm now working on intrinsics and specifics), so I'd
like to know if someone knows how to deal with this.
Since I don't really understand the code in gfc_conv_intrinsic_mod(),
I won't be able to do it myself. If nobody speaks up, I will file a PR
in bugzilla but won't be able to work on large real kinds.
Thanks,
FX
More information about the Fortran
mailing list