public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [patch,fortran] F2003 Inquire features
@ 2008-04-07 21:52 Tobias Burnus
  2008-04-07 22:38 ` Jerry DeLisle
  0 siblings, 1 reply; 3+ messages in thread
From: Tobias Burnus @ 2008-04-07 21:52 UTC (permalink / raw)
  To: Jerry DeLisle, fortran, gcc-patches

> Attached is the final patch of this installment.

Thanks for the patch!

> Regression tested and NIST tested.  I am still working up test cases to
> add.
> 
> OK to commit?

OK after fixing the issues mentioned below.

Index: gcc/fortran/io.c:
| 
|        if (open->encoding->expr_type == EXPR_CONSTANT)
|  	{
| -	  static const char * encoding[] = { "UTF-8", "DEFAULT", NULL };
| +	  static const char * encoding[] = { "DEFAULT", NULL };

Add a TODO: UTF-8 there. (In the library there is already such a TODO.)


Index: libgfortran/io/inquire.c:
+	  case ROUND_UNSPECIFIED:
+	    p = "UNSPECIFIED";
+	    break;

This is wrong.

The standard mandates ("9.9.1.26 ROUND= specifier in the INQUIRE statement"):
"The scalar-default-char-variable in the ROUND= specifier is assigned
 the value UP, DOWN, ZERO, NEAREST, COMPATIBLE, or PROCESSOR_DEFINED,
 corresponding to the I/O rounding mode in effect for a connection for
 formatted input/output. If there is no connection or if the connection
 is not for formatted input/output, the scalar-default-char-variable is
 assigned the value UNDEFINED. The processor shall return the value
 PROCESSOR_DEFINED only if the I/O rounding mode currently in effect
 behaves differently than the UP, DOWN, ZERO, NEAREST, and COMPATIBLE
 modes."

Therefore, if the rounding mode has not been specified, the default
rounding mode should be returned. As we currently do not know which one
we have, we should return "PROCESSOR_DEFINED". If you replace the
string, please add also TODO there.

As soon as we figured out which rounding mode gfortran currently has
or which default rounding mode we want to have, we should return this
one instead. (Unless, it turns out that it neither of the up/down/zero/
nearest/compatible, which I do not think.) On my system I have
"COMPATIBLE"; the rounding seems to depend on the system libc's printf
and POSIX says that the rounding is system dependent, which means that
"PROCESSOR_DEFINED" is the right choice - at least for the moment.

Tobias

^ permalink raw reply	[flat|nested] 3+ messages in thread
[parent not found: <1207551203.3028.25.camel@lenova.localdomain>]

end of thread, other threads:[~2008-04-07 22:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-07 21:52 [patch,fortran] F2003 Inquire features Tobias Burnus
2008-04-07 22:38 ` Jerry DeLisle
     [not found] <1207551203.3028.25.camel@lenova.localdomain>
     [not found] ` <1207551605.19244.1.camel@lenova.localdomain>
2008-04-07 20:50   ` Jerry DeLisle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).