[patch,fortran] PRs 19363 and 19691, Cygwin failure in formatted write of Inf and NaN

Paul Thomas paulthomas2@wanadoo.fr
Mon Jan 31 22:25:00 GMT 2005


This also fixes the testsuite failures, under Cygwin, of complex_write.f90, 
fmt_read.f90 and nan_inf_fmt.f90. No extra compilation warnings. Regtested 
under CYGWIN_NT-5.1 and RedHat9.

 PR libfortran/19363 and 19691
	* io/write.c (write_float): gfc_isfinite(x): macro substitution for Cygwin 
of broken isfinite(x) with finite(x).

Patch:

$ diff -c write.c /cygdrive/d/gcc-cvs/gcc/libgfortran/io/write.c
*** write.c     Mon Jan 31 23:07:16 2005
--- /cygdrive/d/gcc-cvs/gcc/libgfortran/io/write.c      Mon Jan 31 22:17:20 
2005

***************
*** 39,44 ****
--- 39,51 ----

  #define star_fill(p, n) memset(p, '*', n)

+ /*Fix for broken isfinite(x) in Cygwin. */
+ #if defined(__CYGWIN__)
+ #define gfc_isfinite(x) finite(x)
+ #else
+ #define gfc_isfinite(x) isfinite(x)
+ #endif
+
  typedef enum
  { SIGN_NONE, SIGN_MINUS, SIGN_PLUS }
  sign_t;
***************
*** 674,680 ****

    if (f->format != FMT_B && f->format != FMT_O && f->format != FMT_Z)
      {
!       res = isfinite (n);
        if (res == 0)
        {
          nb =  f->u.real.w;
--- 681,687 ----

    if (f->format != FMT_B && f->format != FMT_O && f->format != FMT_Z)
      {
!       res = gfc_isfinite (n);
        if (res == 0)
        {
          nb =  f->u.real.w; 




More information about the Fortran mailing list