[Bug fortran/52413] Incorrect behavior of FRACTION when applied to a constant

fxcoudert at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jun 23 15:43:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52413

--- Comment #12 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #10)
> +  y=fraction (-2.0) 
> +  write (buf, *) y
> +  if (buf(1:10) /= " -0.500000") call abort ()

Why involve I/O in your test, and not just test the value like that:

  if (fraction(-2.0) /= -0.5) call abort()

and, slightly more complicated to handle negative zero, checking both value and
sign:

  if (fraction(-0.0) /= 0.0) call abort
  if (sign(1.0, fraction(-0.0)) /= -1.0) call abort



More information about the Gcc-bugs mailing list