[gfortran] patch for pr 15413
Janne Blomqvist
jblomqvi@cc.hut.fi
Thu May 13 22:03:00 GMT 2004
The Fortran standard specifies that list-directed output should begin
with a blank. This patch will make it so. Numbers already do this
correctly, so the patch only changes output of characters.
Additionally, the patch changes the output of logicals to be L2, as
the comment in the source code actually says. E.g. this means that the
program
program foo
print *, .TRUE., .FALSE.
end program foo
should print:
T F
Previously it printed:
T F
I.e. there were two spaces between the values. I tried with ifort and
xlf, and they print it out as the first example. And according to that
same source code comment, DEC FORTRAN also does it, so I guess it's
the usual way of doing things.
==================================================================
diff -c3 -p write.c.orig write.c
*** write.c.orig Thu May 13 23:09:02 2004
--- write.c Fri May 14 00:54:52 2004
*************** write_char (char c)
*** 880,886 ****
static void
write_logical (const char *source, int length)
{
- write_char (' ');
write_char (extract_int (source, length) ? 'T' : 'F');
}
--- 880,885 ----
*************** list_formatted_write (bt type, void *p,
*** 1039,1044 ****
--- 1038,1045 ----
{
g.first_item = 0;
char_flag = 0;
+ if (type == BT_CHARACTER || type == BT_LOGICAL)
+ write_char(' ');
}
else
{
=================================================================
write.c.orig here refers to tree-ssa 20040513
(Ok, so the patch is quite trivial, but it's my first patch ever to
gcc, so.. be gentle ;-) )
--
Janne Blomqvist
More information about the Fortran
mailing list