[Bug libfortran/34209] run-time lib: NEAREST(0.0_8, -1.0) produces wrong numbers
jvdelisle at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Nov 23 21:14:00 GMT 2007
------- Comment #3 from jvdelisle at gcc dot gnu dot org 2007-11-23 21:14 -------
This appears to fix the problem:
}
void
! gfc_resolve_nearest (gfc_expr *f, gfc_expr *a, gfc_expr *p)
{
+ if (p != NULL && p->ts.kind < a->ts.kind)
+ {
+ if (a->ts.kind == gfc_kind_max (a,p))
+ gfc_convert_type (p, &a->ts, 2);
+ else
+ gfc_convert_type (a, &p->ts, 2);
+ }
f->ts = a->ts;
f->value.function.name
= gfc_get_string ("__nearest_%c%d", gfc_type_letter (a->ts.type),
We might want to think this through a bit for other combinations of kinds in
the arguments given.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34209
More information about the Gcc-bugs
mailing list