public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/60286] New: INQUIRE reports STDOUT as not writable
@ 2014-02-20  9:00 a.vogt at fulguritus dot com
  2014-02-20  9:29 ` [Bug fortran/60286] " a.vogt at fulguritus dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: a.vogt at fulguritus dot com @ 2014-02-20  9:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60286

            Bug ID: 60286
           Summary: INQUIRE reports STDOUT as not writable
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: a.vogt at fulguritus dot com

Created attachment 32178
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32178&action=edit
Minumum Example

The INQUIRE statement reports STDOUT as not writable: Compiling the minumum
example attached results in: 

./a.out 
 writable? NO 

with gfortran (4.8.2 20131212 (Red Hat 4.8.2-7) (GCC)), and into 

./a.out 
 writable? YES  

using ifort (13.1.3). This was also discussed on the mailing list in 2009
(http://gcc.gnu.org/ml/fortran/2009-03/msg00102.html), but I couldn't find any
corresponding bug report. 

gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--enable-initfini-array --enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-isl=/builddir/build/BUILD/gcc-4.8.2-20131212/obj-x86_64-redhat-linux/isl-install
--with-cloog=/builddir/build/BUILD/gcc-4.8.2-20131212/obj-x86_64-redhat-linux/cloog-install
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC)

ifort -V
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R)
64, Version 13.1.3.192 Build 20130607
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/60286] INQUIRE reports STDOUT as not writable
  2014-02-20  9:00 [Bug fortran/60286] New: INQUIRE reports STDOUT as not writable a.vogt at fulguritus dot com
@ 2014-02-20  9:29 ` a.vogt at fulguritus dot com
  2014-02-20 10:12 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: a.vogt at fulguritus dot com @ 2014-02-20  9:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60286

--- Comment #1 from Alexander Vogt <a.vogt at fulguritus dot com> ---
I just found out that the same holds true for STDERR...


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/60286] INQUIRE reports STDOUT as not writable
  2014-02-20  9:00 [Bug fortran/60286] New: INQUIRE reports STDOUT as not writable a.vogt at fulguritus dot com
  2014-02-20  9:29 ` [Bug fortran/60286] " a.vogt at fulguritus dot com
@ 2014-02-20 10:12 ` burnus at gcc dot gnu.org
  2014-02-21  7:37 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-02-20 10:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60286

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |jvdelisle at gcc dot gnu.org

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Something like this should do.

(Requires more updates in the file, e.g. also for READ=, READWRITE= - and for
the "YES" / yes  cleanup.)

--- a/libgfortran/io/inquire.c
+++ b/libgfortran/io/inquire.c
@@ -33 +33 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not,
see
-static const char undefined[] = "UNDEFINED";
+static const char yes[] = "YES", no[] = "NO", undefined[] = "UNDEFINED";
@@ -133 +133 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u)
-        p = "NO";
+        p = no;
@@ -136 +136 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u)
-        p = "YES";
+        p = yes;
@@ -510 +510,7 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u)
-      p = (u == NULL) ? inquire_write (NULL, 0) :
+      if (u && u->unit_number == options.stdin_unit)
+    p = no;
+      else if (u
+           && (u->unit_number == options.stdout_unit
+           || u->unit_number == options.stderr_unit))
+    p = yes;
+      else if (u)
@@ -511,0 +518,2 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u)
+      else
+    inquire_write (NULL, 0) :


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/60286] INQUIRE reports STDOUT as not writable
  2014-02-20  9:00 [Bug fortran/60286] New: INQUIRE reports STDOUT as not writable a.vogt at fulguritus dot com
  2014-02-20  9:29 ` [Bug fortran/60286] " a.vogt at fulguritus dot com
  2014-02-20 10:12 ` burnus at gcc dot gnu.org
@ 2014-02-21  7:37 ` burnus at gcc dot gnu.org
  2014-02-21  7:38 ` burnus at gcc dot gnu.org
  2014-02-21  8:43 ` a.vogt at fulguritus dot com
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-02-21  7:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60286

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Author: burnus
Date: Fri Feb 21 07:37:06 2014
New Revision: 207979

URL: http://gcc.gnu.org/viewcvs?rev=207979&root=gcc&view=rev
Log:
2014-02-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/60286
        * libgfortran/io/inquire.c (yes, no): New static const char
        * vars.
        (inquire_via_unit): Use them. Use OPEN mode instead of using
        POSIX's access to query about write=, read= and readwrite=.

2014-02-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/60286
        * gfortran.dg/inquire_16.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/inquire_16.f90
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/inquire.c


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/60286] INQUIRE reports STDOUT as not writable
  2014-02-20  9:00 [Bug fortran/60286] New: INQUIRE reports STDOUT as not writable a.vogt at fulguritus dot com
                   ` (2 preceding siblings ...)
  2014-02-21  7:37 ` burnus at gcc dot gnu.org
@ 2014-02-21  7:38 ` burnus at gcc dot gnu.org
  2014-02-21  8:43 ` a.vogt at fulguritus dot com
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-02-21  7:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60286

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED on the trunk (for GCC 4.9).

Thanks for the report!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/60286] INQUIRE reports STDOUT as not writable
  2014-02-20  9:00 [Bug fortran/60286] New: INQUIRE reports STDOUT as not writable a.vogt at fulguritus dot com
                   ` (3 preceding siblings ...)
  2014-02-21  7:38 ` burnus at gcc dot gnu.org
@ 2014-02-21  8:43 ` a.vogt at fulguritus dot com
  4 siblings, 0 replies; 6+ messages in thread
From: a.vogt at fulguritus dot com @ 2014-02-21  8:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60286

--- Comment #5 from Alexander Vogt <a.vogt at fulguritus dot com> ---
Thanks for fixing it *that* fast (I'm impressed)!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-02-21  8:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-20  9:00 [Bug fortran/60286] New: INQUIRE reports STDOUT as not writable a.vogt at fulguritus dot com
2014-02-20  9:29 ` [Bug fortran/60286] " a.vogt at fulguritus dot com
2014-02-20 10:12 ` burnus at gcc dot gnu.org
2014-02-21  7:37 ` burnus at gcc dot gnu.org
2014-02-21  7:38 ` burnus at gcc dot gnu.org
2014-02-21  8:43 ` a.vogt at fulguritus dot com

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).