public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/101255] New: FLUSH statement - error should be negative
@ 2021-06-29 11:09 burnus at gcc dot gnu.org
  2021-07-01 20:12 ` [Bug fortran/101255] " kargl at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-06-29 11:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101255

            Bug ID: 101255
           Summary: FLUSH statement - error should be negative
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

F2018 states:

"Fortran 2008 specifies that the IOSTAT= variable shall be set to a
processor-dependent negative value if the flush operation is not supported for
the unit specified. This document specifies that the processor-dependent
negative27integer value shall be different from the named constants IOSTAT_EOR
or IOSTAT_END from the intrinsic28module ISO_FORTRAN_ENV."

However, the following program prints:
        5002 Specified UNIT in FLUSH is not connected          
          -2          -1
shouldn't the 5002 be a negative number (such as -5002)?

use iso_fortran_env
implicit none
character(len=50) :: err
integer :: i
!open(99)
!close(99)
flush(99,iostat=i,iomsg=err)
print *, i, err
print *, IOSTAT_EOR , IOSTAT_END 
end

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

* [Bug fortran/101255] FLUSH statement - error should be negative
  2021-06-29 11:09 [Bug fortran/101255] New: FLUSH statement - error should be negative burnus at gcc dot gnu.org
@ 2021-07-01 20:12 ` kargl at gcc dot gnu.org
  2021-07-18 20:22 ` [Bug libfortran/101255] " anlauf at gcc dot gnu.org
  2021-12-16 16:49 ` fxcoudert at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-07-01 20:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101255

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org
           Priority|P3                          |P4

--- Comment #1 from kargl at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #0)
> F2018 states:
> 
> "Fortran 2008 specifies that the IOSTAT= variable shall be set to a
> processor-dependent negative value if the flush operation is not supported
> for the unit specified. This document specifies that the processor-dependent
> negative27integer value shall be different from the named constants
> IOSTAT_EOR or IOSTAT_END from the intrinsic28module ISO_FORTRAN_ENV."
> 
> However, the following program prints:
>         5002 Specified UNIT in FLUSH is not connected          
>           -2          -1
> shouldn't the 5002 be a negative number (such as -5002)?
> 
> use iso_fortran_env
> implicit none
> character(len=50) :: err
> integer :: i
> !open(99)
> !close(99)
> flush(99,iostat=i,iomsg=err)
> print *, i, err
> print *, IOSTAT_EOR , IOSTAT_END 
> end

diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c
index 7e71ca577e0..4ed1698f17a 100644
--- a/libgfortran/io/file_pos.c
+++ b/libgfortran/io/file_pos.c
@@ -527,7 +527,7 @@ st_flush (st_parameter_filepos *fpp)
     }
   else
     /* FLUSH on unconnected unit is illegal: F95 std., 9.3.5. */ 
-    generate_error (&fpp->common, LIBERROR_BAD_OPTION,
+    generate_error (&fpp->common, -LIBERROR_BAD_UNIT,
                        "Specified UNIT in FLUSH is not connected");

   if (needs_unlock)

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

* [Bug libfortran/101255] FLUSH statement - error should be negative
  2021-06-29 11:09 [Bug fortran/101255] New: FLUSH statement - error should be negative burnus at gcc dot gnu.org
  2021-07-01 20:12 ` [Bug fortran/101255] " kargl at gcc dot gnu.org
@ 2021-07-18 20:22 ` anlauf at gcc dot gnu.org
  2021-12-16 16:49 ` fxcoudert at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-07-18 20:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101255

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|fortran                     |libfortran
   Last reconfirmed|                            |2021-07-18
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from anlauf at gcc dot gnu.org ---
Confirmed.  Changing component to libfortran.

In F2018 the IOSTAT= specifier is described in 12.11.5.

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

* [Bug libfortran/101255] FLUSH statement - error should be negative
  2021-06-29 11:09 [Bug fortran/101255] New: FLUSH statement - error should be negative burnus at gcc dot gnu.org
  2021-07-01 20:12 ` [Bug fortran/101255] " kargl at gcc dot gnu.org
  2021-07-18 20:22 ` [Bug libfortran/101255] " anlauf at gcc dot gnu.org
@ 2021-12-16 16:49 ` fxcoudert at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2021-12-16 16:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101255

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu.org
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |12.0
         Resolution|---                         |FIXED

--- Comment #3 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Fixed at
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c14f38d4292ec22462a4080841d526f87428130a

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

end of thread, other threads:[~2021-12-16 16:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29 11:09 [Bug fortran/101255] New: FLUSH statement - error should be negative burnus at gcc dot gnu.org
2021-07-01 20:12 ` [Bug fortran/101255] " kargl at gcc dot gnu.org
2021-07-18 20:22 ` [Bug libfortran/101255] " anlauf at gcc dot gnu.org
2021-12-16 16:49 ` fxcoudert at gcc dot gnu.org

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