This is the mail archive of the gcc-bugs@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]

[Bug libfortran/21376] New: libfortran "E" output format causes FPE


There's an obvious bug in libfortran/io/write.c which causes a failure
to print "1.0" in exp. format - here's the fix:

diff -U3 -r gcc-4.0.0-old/libgfortran/io/write.c gcc-4.0.0/libgfortran/io/write.c
--- gcc-4.0.0-old/libgfortran/io/write.c        2005-04-05 15:24:36.000000000 +0100
+++ gcc-4.0.0/libgfortran/io/write.c    2005-05-04 07:55:12.000000000 +0100
@@ -316,9 +316,11 @@
     edigits = 2;
   else
     {
-      edigits = 1 + (int) log10 (fabs(log10 (value)));
-      if (edigits < 2)
+      double absexp = fabs(log10 (value));
+      if (absexp < 100)
        edigits = 2;
+      else
+       edigits = 1 + (int) log10 (absexp);
     }

   if (ft == FMT_F || ft == FMT_EN

-- 
           Summary: libfortran "E" output format causes FPE
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: prw at ceiriog1 dot demon dot co dot uk
                CC: gcc-bugs at gcc dot gnu dot org,prw at ceiriog1 dot
                    demon dot co dot uk
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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