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

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