public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libf2c/11918] New: isatty does not call f_init
@ 2003-08-14 12:20 nvwarr at hotmail dot com
  2003-08-23  2:54 ` [Bug libf2c/11918] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: nvwarr at hotmail dot com @ 2003-08-14 12:20 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: isatty does not call f_init
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libf2c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nvwarr at hotmail dot com
                CC: gcc-bugs at gcc dot gnu dot org

When calling a fortran subroutine from a C program, using isatty on stdin gives
a segmentation fault:
#0  0x400db449 in fileno_unlocked () from /lib/i686/libc.so.6
#1  0x40040417 in G77_fnum_0 () from /usr/lib/libg2c.so.0
#2  0x400407c8 in G77_isatty_0 () from /usr/lib/libg2c.so.0

This does not occur if f_init is called either explicitly from the C program, or
implicitly by calling some function which calls f_init.

There are three ways to fix it:
1) modify the C program to call f_init explicitly.
2) add a dummy write statement to the fortran code to force it to call f_init
implicitly
3) add a line to libf2c/libU77/isatty_.c:
if (f__init != 1) f_init();

Perhaps this line should really be added to libf2c/libU77/fnum_.c?

Probably there is another bug involving fnum as well. It looks as though the
code doesn't check if
the unit is actually open, so calling isatty (and anything else which calls
fnum) with a unit which has
been closed (or never opened) will cause a segmentation fault in fileno_unlocked
rather than a useful error message, regardless of whether f_init has been called
or not.


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

* [Bug libf2c/11918] isatty does not call f_init
  2003-08-14 12:20 [Bug libf2c/11918] New: isatty does not call f_init nvwarr at hotmail dot com
@ 2003-08-23  2:54 ` pinskia at gcc dot gnu dot org
  2003-08-24 22:59 ` dhazeghi at yahoo dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-23  2:54 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
   Target Milestone|3.4                         |---


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

* [Bug libf2c/11918] isatty does not call f_init
  2003-08-14 12:20 [Bug libf2c/11918] New: isatty does not call f_init nvwarr at hotmail dot com
  2003-08-23  2:54 ` [Bug libf2c/11918] " pinskia at gcc dot gnu dot org
@ 2003-08-24 22:59 ` dhazeghi at yahoo dot com
  2003-09-10  6:22 ` nvwarr at hotmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-24 22:59 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


dhazeghi at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


------- Additional Comments From dhazeghi at yahoo dot com  2003-08-24 22:59 -------
Hello, would you mind attaching a testcase to this report that demonstrates the problem you've 
encountered? Also, if you have the opportunity to test with a newer version of gcc, that'd be quite 
helpful. Thanks.


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

* [Bug libf2c/11918] isatty does not call f_init
  2003-08-14 12:20 [Bug libf2c/11918] New: isatty does not call f_init nvwarr at hotmail dot com
  2003-08-23  2:54 ` [Bug libf2c/11918] " pinskia at gcc dot gnu dot org
  2003-08-24 22:59 ` dhazeghi at yahoo dot com
@ 2003-09-10  6:22 ` nvwarr at hotmail dot com
  2003-09-13 21:39 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: nvwarr at hotmail dot com @ 2003-09-10  6:22 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From nvwarr at hotmail dot com  2003-09-10 06:22 -------
I originally reported this but to RedHat's bugzilla with a test case. It seems
that subject line was forwarded by someone but without the explanation. So I'm
cutting and pasting what I sent to RedHat...


Description of problem:
Using a main program in C and a subroutine in Fortran, where the Fortran
uses isatty without using any other Fortran I/O, results in a segmentation fault
at that point.

Inserting another Fortran I/O operation before the call to isatty works around
the problem. Alternatively, calling f_init explicitly from the C code before
calling the Fortran also works.

My problem occurs in a large complicated set of code mixing C and Fortran, but
the example below illustrates the problem.

Version-Release number of selected component (if applicable):
gcc-g77-3.2-7


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

* [Bug libf2c/11918] isatty does not call f_init
  2003-08-14 12:20 [Bug libf2c/11918] New: isatty does not call f_init nvwarr at hotmail dot com
                   ` (2 preceding siblings ...)
  2003-09-10  6:22 ` nvwarr at hotmail dot com
@ 2003-09-13 21:39 ` pinskia at gcc dot gnu dot org
  2003-09-13 22:16 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-13 21:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-13 19:09 -------
Thats move this into a ...


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

* [Bug libf2c/11918] isatty does not call f_init
  2003-08-14 12:20 [Bug libf2c/11918] New: isatty does not call f_init nvwarr at hotmail dot com
                   ` (3 preceding siblings ...)
  2003-09-13 21:39 ` pinskia at gcc dot gnu dot org
@ 2003-09-13 22:16 ` pinskia at gcc dot gnu dot org
  2003-09-21 18:48 ` pinskia at gcc dot gnu dot org
  2003-12-09 18:17 ` dhazeghi at yahoo dot com
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-13 22:16 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

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


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-13 19:09 -------
virgin state.


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

* [Bug libf2c/11918] isatty does not call f_init
  2003-08-14 12:20 [Bug libf2c/11918] New: isatty does not call f_init nvwarr at hotmail dot com
                   ` (4 preceding siblings ...)
  2003-09-13 22:16 ` pinskia at gcc dot gnu dot org
@ 2003-09-21 18:48 ` pinskia at gcc dot gnu dot org
  2003-12-09 18:17 ` dhazeghi at yahoo dot com
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-21 18:48 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

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


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-21 16:43 -------
Fixed by:
	2003-09-21  Toon Moene  <toon@moene.indiv.nluug.nl>
	
	PR libf2c/11918
	* fstat_.c: Call f_init().
	* isatty_.c: Ditto.
	* fnum_.c: Check file descriptor before handing it back.


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

* [Bug libf2c/11918] isatty does not call f_init
  2003-08-14 12:20 [Bug libf2c/11918] New: isatty does not call f_init nvwarr at hotmail dot com
                   ` (5 preceding siblings ...)
  2003-09-21 18:48 ` pinskia at gcc dot gnu dot org
@ 2003-12-09 18:17 ` dhazeghi at yahoo dot com
  6 siblings, 0 replies; 8+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-12-09 18:17 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.4


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


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

end of thread, other threads:[~2003-12-09 18:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-14 12:20 [Bug libf2c/11918] New: isatty does not call f_init nvwarr at hotmail dot com
2003-08-23  2:54 ` [Bug libf2c/11918] " pinskia at gcc dot gnu dot org
2003-08-24 22:59 ` dhazeghi at yahoo dot com
2003-09-10  6:22 ` nvwarr at hotmail dot com
2003-09-13 21:39 ` pinskia at gcc dot gnu dot org
2003-09-13 22:16 ` pinskia at gcc dot gnu dot org
2003-09-21 18:48 ` pinskia at gcc dot gnu dot org
2003-12-09 18:17 ` dhazeghi at yahoo 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).