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]

[gfortran] PATCH Re: Typo in gfc_conv_mpf_to_tree()



An old e-mail that I found: Tobias Schlüter wrote:

I just spotted an apparent typo in gfc_conv_mpf_to_tree(): trans-const.c:255 reads:
n = MAX (abs (gfc_real_kinds[n].min_exponent),
abs (gfc_real_kinds[n].min_exponent));
One of those should certainly be max_exponent.



I committed below patch as obvious. Compiled and tested.


Another thing that struck my eyes: the lines immediately following read:
#if 0
edigits = 2 + (int) (log (n) / log (gfc_real_kinds[n].radix));
#endif
edigits = 1;
while (n > 0)
{
n = n / 10;
edigits += 3;
}
The #if 0'd line is obviously wrong -- n appears in two incompatible ways. Could it be that this bug is the cause it didn't work and the reason it's #if 0'd?


- Tobi

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/ChangeLog,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -p -r1.29 -r1.30
--- ChangeLog   18 May 2004 11:09:29 -0000      1.29
+++ ChangeLog   18 May 2004 16:48:09 -0000      1.30
@@ -1,4 +1,8 @@
-2004-05-17  Steve Kargl  <kargls@comcast.net>
+2004-05-18  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       * trans-const.c (gfc_conv_mpf_to_tree): Fix typo.
+
+2004-05-18  Steve Kargl  <kargls@comcast.net>

* arith.c (gfc_int2complex): Fix incorrect range checking.

Index: trans-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-const.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- trans-const.c       14 May 2004 13:00:04 -0000      1.3
+++ trans-const.c       18 May 2004 16:48:09 -0000      1.4
@@ -252,7 +252,7 @@ gfc_conv_mpf_to_tree (mpf_t f, int kind)
   assert (gfc_real_kinds[n].radix == 2);

   n = MAX (abs (gfc_real_kinds[n].min_exponent),
-          abs (gfc_real_kinds[n].min_exponent));
+          abs (gfc_real_kinds[n].max_exponent));
 #if 0
   edigits = 2 + (int) (log (n) / log (gfc_real_kinds[n].radix));
 #endif



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