inverted logic in arith.c:gfc_range_check()?
Steve Kargl
sgk@troutmask.apl.washington.edu
Sun May 16 17:52:00 GMT 2004
Gang,
In reading through arith.c, I notice that gfc_range_check()
contained the snippet:
case BT_COMPLEX:
rc = gfc_check_real_range (e->value.complex.r, e->ts.kind);
if (rc != ARITH_OK)
rc = gfc_check_real_range (e->value.complex.i, e->ts.kind);
where gfc_range_check() supposely checks that the "constant numeric
expression is within the range for its type and kind.". Suppose,
we somehow have a complex number of (1e50, 1.). The first call
will set rc = ARITH_OVERFLOW, and then the expression in the
if () is true. The second call to gfc_check_real_range will return
ARITH_OK. So, gfc_check_real_range() will return ARITH_OK, which
seems contrary to the value of (1e50, 1.). Should "!=" actually
be "=="? That is, if the real is ok, then check the imaginary part.
--
Steve
More information about the Fortran
mailing list