This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] libgfortran: write_float bug


> 2004-07-07  Andreas Krebbel <krebbel1@de.ibm.com>
>
> 	* libgfortran/io/write.c: (write_float): Added length check.

Applied, thanks.
I also changed the memset calls into direct assignments.

Index: write.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/libgfortran/io/write.c,v
retrieving revision 1.7
diff -u -p -r1.7 write.c
--- write.c	28 Jun 2004 01:30:26 -0000	1.7
+++ write.c	8 Jul 2004 19:51:19 -0000
@@ -535,10 +535,10 @@ write_float (fnode *f, const char *sourc
                memcpy(p + nb - 8, "Infinity", 8); 
             else
                memcpy(p + nb - 3, "Inf", 3);
-            if (nb < 8)
-               memset(p + nb - 4, fin, 1);
+            if (nb < 8 && nb > 3)
+               p[nb - 4] = fin;
             else if (nb > 8)
-               memset(p + nb - 9, fin, 1); 
+               p[nb - 9] = fin; 
           }
          else
              memcpy(p + nb - 3, "NaN", 3);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]