This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
BUG: infinite loop in _IO_flush_all()
- To: egcs-bugs at cygnus dot com
- Subject: BUG: infinite loop in _IO_flush_all()
- From: Eric Ding <ericding at applix dot com>
- Date: Wed, 29 Jul 1998 16:07:21 -0400
Hi,
I'm building an application on a RedHat 4.2 system, libc 5.3.12, egcs
1.0.3a. Unfortunately, this is proprietary commercial code, so I can't
share source at this point, but I'm running into an infinite loop when
compiling my program with egcs 1.0.3a. This does not occur on a libc6
system such as RedHat 5.1. Because our code uses the Blackdown Java
port libraries, I believe the executable is actually using libc.5.4.33,
introducing (I suppose) possibly more complexities.
After calling return() or exit(), my program is hanging in
_IO_flush_all (lines 664 and 665); there seems to be an infinite loop in
the _IO_list_all linked list. I've included the log of gdb below. If I
can be of more help, please let me know. For now, I'm working around
this issue by calling _exit() so that IO buffers aren't flushed.
Thanks,
Eric
(gdb) list
660 _IO_flush_all ()
661 {
662 int result = 0;
663 _IO_FILE *fp;
664 for (fp = _IO_list_all; fp != NULL; fp = fp->_chain)
665 if (fp->_IO_write_ptr > fp->_IO_write_base
666 && _IO_OVERFLOW (fp, EOF) == EOF)
667 result = EOF;
668 return result;
669 }
(gdb) n
664 for (fp = _IO_list_all; fp != NULL; fp = fp->_chain)
(gdb) p fp
$1 = (_IO_FILE *) 0x810f9c8
(gdb) n
665 if (fp->_IO_write_ptr > fp->_IO_write_base
(gdb) display fp
1: fp = (_IO_FILE *) 0x810f9c8
(gdb) display fp->_IO_write_ptr
2: fp->_IO_write_ptr = 0x40007000 ""
(gdb) display fp->_IO_write_base
3: fp->_IO_write_base = 0x40007000 ""
(gdb) n
664 for (fp = _IO_list_all; fp != NULL; fp = fp->_chain)
3: fp->_IO_write_base = 0x40007000 ""
2: fp->_IO_write_ptr = 0x40007000 ""
1: fp = (_IO_FILE *) 0x810f9c8
(gdb)
665 if (fp->_IO_write_ptr > fp->_IO_write_base
3: fp->_IO_write_base = 0x40007000 ""
2: fp->_IO_write_ptr = 0x40007000 ""
1: fp = (_IO_FILE *) 0x810f9c8
(gdb)
664 for (fp = _IO_list_all; fp != NULL; fp = fp->_chain)
3: fp->_IO_write_base = 0x40007000 ""
2: fp->_IO_write_ptr = 0x40007000 ""
1: fp = (_IO_FILE *) 0x810f9c8
(gdb) p fp->_chain
$2 = (struct _IO_FILE *) 0x810f9c8