public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/46373] New: fflush called when reading from a string
@ 2010-11-08 15:38 e01reynier at gmail dot com
2010-11-08 17:05 ` [Bug libfortran/46373] " kargl at gcc dot gnu.org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: e01reynier at gmail dot com @ 2010-11-08 15:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
Summary: fflush called when reading from a string
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: e01reynier@gmail.com
When reading a integer from a string (ie READ(string,'(I3)') number) it calls
fflush from flush_if_preconnected routine inside data_transfer_init routine.
It causes me trouble in a C thread waiting for keyboard calling getc.
Is there a valid reason for calling fflush while reading a string ?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/46373] fflush called when reading from a string
2010-11-08 15:38 [Bug libfortran/46373] New: fflush called when reading from a string e01reynier at gmail dot com
@ 2010-11-08 17:05 ` kargl at gcc dot gnu.org
2010-11-08 17:47 ` jvdelisle at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: kargl at gcc dot gnu.org @ 2010-11-08 17:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2010.11.08 17:05:08
CC| |kargl at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from kargl at gcc dot gnu.org 2010-11-08 17:05:08 UTC ---
See the documentation that comes with gfortran.
You can use
* GFORTRAN_UNBUFFERED_ALL:: Don't buffer I/O for all units.
* GFORTRAN_UNBUFFERED_PRECONNECTED:: Don't buffer I/O for preconnected units.
to control the buffering of IO.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/46373] fflush called when reading from a string
2010-11-08 15:38 [Bug libfortran/46373] New: fflush called when reading from a string e01reynier at gmail dot com
2010-11-08 17:05 ` [Bug libfortran/46373] " kargl at gcc dot gnu.org
@ 2010-11-08 17:47 ` jvdelisle at gcc dot gnu.org
2010-11-09 7:51 ` e01reynier at gmail dot com
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2010-11-08 17:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jvdelisle at gcc dot
| |gnu.org
--- Comment #2 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-11-08 17:47:14 UTC ---
An internal unit fflush is:
static int
mem_flush (unix_stream * s __attribute__ ((unused)))
{
return 0;
}
So I don't think this is your issue.
Maybe something else?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/46373] fflush called when reading from a string
2010-11-08 15:38 [Bug libfortran/46373] New: fflush called when reading from a string e01reynier at gmail dot com
2010-11-08 17:05 ` [Bug libfortran/46373] " kargl at gcc dot gnu.org
2010-11-08 17:47 ` jvdelisle at gcc dot gnu.org
@ 2010-11-09 7:51 ` e01reynier at gmail dot com
2010-11-09 7:55 ` e01reynier at gmail dot com
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: e01reynier at gmail dot com @ 2010-11-09 7:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
--- Comment #3 from e01reynier at gmail dot com 2010-11-09 07:50:37 UTC ---
(In reply to comment #1)
> See the documentation that comes with gfortran.
>
> You can use
>
> * GFORTRAN_UNBUFFERED_ALL:: Don't buffer I/O for all units.
> * GFORTRAN_UNBUFFERED_PRECONNECTED:: Don't buffer I/O for preconnected units.
>
> to control the buffering of IO.
I try under bash with:
export GFORTRAN_UNBUFFERED_ALL=y
or
export GFORTRAN_UNBUFFERED_PRECONNECTED=y
but fflush is always called when I read from a string.
Anyway reading from a string has nothing to do with buffered I/O !
Why the hell is fflush called ?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/46373] fflush called when reading from a string
2010-11-08 15:38 [Bug libfortran/46373] New: fflush called when reading from a string e01reynier at gmail dot com
` (2 preceding siblings ...)
2010-11-09 7:51 ` e01reynier at gmail dot com
@ 2010-11-09 7:55 ` e01reynier at gmail dot com
2010-11-09 13:22 ` jvdelisle at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: e01reynier at gmail dot com @ 2010-11-09 7:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
--- Comment #4 from e01reynier at gmail dot com 2010-11-09 07:54:58 UTC ---
(In reply to comment #2)
> An internal unit fflush is:
Is there really an internal unit involved when reading an integer from a string
?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/46373] fflush called when reading from a string
2010-11-08 15:38 [Bug libfortran/46373] New: fflush called when reading from a string e01reynier at gmail dot com
` (3 preceding siblings ...)
2010-11-09 7:55 ` e01reynier at gmail dot com
@ 2010-11-09 13:22 ` jvdelisle at gcc dot gnu.org
2010-11-09 13:39 ` e01reynier at gmail dot com
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2010-11-09 13:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |ASSIGNED
AssignedTo|unassigned at gcc dot |jvdelisle at gcc dot
|gnu.org |gnu.org
--- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-11-09 13:22:15 UTC ---
In Fortran, by definition, "internal unit" is a character string. Libgfortran
defines a common I/O interface. During initialization of an I/O call, the
appropriate functions are mapped via function pointers so that when the
read/write statements are executed, either the external unit (file) routines or
internal unit (string) routines are invoked.
Regardless, I misunderstood your original post. I will commit the following
obvious patch after regression testing. At least the code lived up to its
comment. ;)
Index: libgfortran/io/transfer.c
===================================================================
--- libgfortran/io/transfer.c (revision 166469)
+++ libgfortran/io/transfer.c (working copy)
@@ -2646,7 +2646,8 @@
}
/* Bugware for badly written mixed C-Fortran I/O. */
- flush_if_preconnected(dtp->u.p.current_unit->s);
+ if (!is_internal_unit (dtp))
+ flush_if_preconnected(dtp->u.p.current_unit->s);
dtp->u.p.current_unit->mode = dtp->u.p.mode;
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/46373] fflush called when reading from a string
2010-11-08 15:38 [Bug libfortran/46373] New: fflush called when reading from a string e01reynier at gmail dot com
` (4 preceding siblings ...)
2010-11-09 13:22 ` jvdelisle at gcc dot gnu.org
@ 2010-11-09 13:39 ` e01reynier at gmail dot com
2010-11-09 13:52 ` jvdelisle at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: e01reynier at gmail dot com @ 2010-11-09 13:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
--- Comment #6 from e01reynier at gmail dot com 2010-11-09 13:39:33 UTC ---
It should solve my problem.
Thanks a lot !
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/46373] fflush called when reading from a string
2010-11-08 15:38 [Bug libfortran/46373] New: fflush called when reading from a string e01reynier at gmail dot com
` (5 preceding siblings ...)
2010-11-09 13:39 ` e01reynier at gmail dot com
@ 2010-11-09 13:52 ` jvdelisle at gcc dot gnu.org
2010-11-09 22:12 ` jvdelisle at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2010-11-09 13:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
--- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-11-09 13:52:03 UTC ---
Author: jvdelisle
Date: Tue Nov 9 13:51:57 2010
New Revision: 166490
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166490
Log:
2010-11-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/46373
* io/transfer.c (data_transfer_init): Do not call flush_if_preconnected
if this is an internal unit.
Modified:
trunk/libgfortran/ChangeLog
trunk/libgfortran/io/transfer.c
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/46373] fflush called when reading from a string
2010-11-08 15:38 [Bug libfortran/46373] New: fflush called when reading from a string e01reynier at gmail dot com
` (6 preceding siblings ...)
2010-11-09 13:52 ` jvdelisle at gcc dot gnu.org
@ 2010-11-09 22:12 ` jvdelisle at gcc dot gnu.org
2010-11-10 8:14 ` e01reynier at gmail dot com
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2010-11-09 22:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
--- Comment #8 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-11-09 22:12:07 UTC ---
Aside from Janne's comments about getting rid of this function completely, I
think the little fix is a candidate for back port to 4.4 and 4.5. What do you
think Janne?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/46373] fflush called when reading from a string
2010-11-08 15:38 [Bug libfortran/46373] New: fflush called when reading from a string e01reynier at gmail dot com
` (7 preceding siblings ...)
2010-11-09 22:12 ` jvdelisle at gcc dot gnu.org
@ 2010-11-10 8:14 ` e01reynier at gmail dot com
2010-11-11 3:12 ` jvdelisle at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: e01reynier at gmail dot com @ 2010-11-10 8:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
--- Comment #9 from e01reynier at gmail dot com 2010-11-10 08:13:54 UTC ---
(In reply to comment #8)
> Aside from Janne's comments about getting rid of this function completely, I
> think the little fix is a candidate for back port to 4.4 and 4.5. What do you
> think Janne?
It would be nice.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/46373] fflush called when reading from a string
2010-11-08 15:38 [Bug libfortran/46373] New: fflush called when reading from a string e01reynier at gmail dot com
` (8 preceding siblings ...)
2010-11-10 8:14 ` e01reynier at gmail dot com
@ 2010-11-11 3:12 ` jvdelisle at gcc dot gnu.org
2010-11-11 3:24 ` jvdelisle at gcc dot gnu.org
2010-11-11 3:29 ` jvdelisle at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2010-11-11 3:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
--- Comment #10 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-11-11 03:12:39 UTC ---
Author: jvdelisle
Date: Thu Nov 11 03:12:35 2010
New Revision: 166588
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166588
Log:
2010-11-10 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/46373
Backport from mainline:
* io/transfer.c (data_transfer_init): Do not call flush_if_preconnected
if this is an internal unit.
Modified:
branches/gcc-4_5-branch/libgfortran/ChangeLog
branches/gcc-4_5-branch/libgfortran/io/transfer.c
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/46373] fflush called when reading from a string
2010-11-08 15:38 [Bug libfortran/46373] New: fflush called when reading from a string e01reynier at gmail dot com
` (9 preceding siblings ...)
2010-11-11 3:12 ` jvdelisle at gcc dot gnu.org
@ 2010-11-11 3:24 ` jvdelisle at gcc dot gnu.org
2010-11-11 3:29 ` jvdelisle at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2010-11-11 3:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
--- Comment #11 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-11-11 03:24:29 UTC ---
Author: jvdelisle
Date: Thu Nov 11 03:24:26 2010
New Revision: 166589
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166589
Log:
2010-11-10 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/46373
Backport from mainline:
* io/transfer.c (data_transfer_init): Do not call flush_if_preconnected
if this is an internal unit.
Modified:
branches/gcc-4_4-branch/libgfortran/ChangeLog
branches/gcc-4_4-branch/libgfortran/io/transfer.c
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/46373] fflush called when reading from a string
2010-11-08 15:38 [Bug libfortran/46373] New: fflush called when reading from a string e01reynier at gmail dot com
` (10 preceding siblings ...)
2010-11-11 3:24 ` jvdelisle at gcc dot gnu.org
@ 2010-11-11 3:29 ` jvdelisle at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2010-11-11 3:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #12 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-11-11 03:28:54 UTC ---
Fixed on 4.4 and 4.5 and closing
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2010-11-11 3:29 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-08 15:38 [Bug libfortran/46373] New: fflush called when reading from a string e01reynier at gmail dot com
2010-11-08 17:05 ` [Bug libfortran/46373] " kargl at gcc dot gnu.org
2010-11-08 17:47 ` jvdelisle at gcc dot gnu.org
2010-11-09 7:51 ` e01reynier at gmail dot com
2010-11-09 7:55 ` e01reynier at gmail dot com
2010-11-09 13:22 ` jvdelisle at gcc dot gnu.org
2010-11-09 13:39 ` e01reynier at gmail dot com
2010-11-09 13:52 ` jvdelisle at gcc dot gnu.org
2010-11-09 22:12 ` jvdelisle at gcc dot gnu.org
2010-11-10 8:14 ` e01reynier at gmail dot com
2010-11-11 3:12 ` jvdelisle at gcc dot gnu.org
2010-11-11 3:24 ` jvdelisle at gcc dot gnu.org
2010-11-11 3:29 ` jvdelisle 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).