This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran] PATCH Re: Typo in gfc_conv_mpf_to_tree()
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: patch <gcc-patches at gcc dot gnu dot org>
- Cc: GCC Fortran mailing list <fortran at gcc dot gnu dot org>
- Date: Tue, 18 May 2004 18:51:10 +0200
- Subject: [gfortran] PATCH Re: Typo in gfc_conv_mpf_to_tree()
- References: <408EB4EE.4010006@physik.uni-muenchen.de>
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