This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, libgfortran] FIX PR19543 formatted output for logical(8) variables
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Tobias Schlueter <Tobias dot Schlueter at Physik dot Uni-Muenchen dot DE>
- Date: Fri, 03 Feb 2006 21:45:46 -0800
- Subject: [patch, libgfortran] FIX PR19543 formatted output for logical(8) variables
The attached patch is a possible fix for this PR. It is obvious and simple and
is probably a work around for the underlying problem in PR 20066.
I noticed that the values being passed to write_logical are correct so I
suspected the problem was types.
The problem is that in write_logical the result of extract_int returns
GFC_INTEGER_LARGEST which when cast to (int) for the conditional test, it works
correctly.
Regression tested and NIST tested. OK for trunk and 4.1?
2006-02-03 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/19543
* io/write.c (write_logical): Cast GFC_INTEGER_LARGEST to (int)
before using in test.
Index: io/write.c
===================================================================
*** io/write.c (revision 110582)
--- io/write.c (working copy)
*************** write_char (st_parameter_dt *dtp, char c
*** 1234,1240 ****
static void
write_logical (st_parameter_dt *dtp, const char *source, int length)
{
! write_char (dtp, extract_int (source, length) ? 'T' : 'F');
}
--- 1234,1240 ----
static void
write_logical (st_parameter_dt *dtp, const char *source, int length)
{
! write_char (dtp, (int) extract_int (source, length) ? 'T' : 'F');
}