This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: weird egcs bug
- To: Greg Bacon <gbacon at cs dot uah dot edu>
- Subject: Re: weird egcs bug
- From: Mo McKinlay <mmckinlay at labs dot interopen dot org>
- Date: Thu, 16 Mar 2000 01:38:32 +0000 (GMT)
- cc: egcs-bugs at egcs dot cygnus dot com
# read_words(pid_t k1, int fd1, pid_t k2, int fd2)
# {
[snip]
# If I uncomment the printf line, control exits the loop as expected.
# Without it, however, the program hangs. When I run it in the
# debugger, b read_words, run, c, I don't see the behavior! When I just
# run the code and interrupt it, I see
#
# Program received signal SIGINT, Interrupt.
# 0x400c19ee in __select ()
# (gdb) where
# #0 0x400c19ee in __select ()
# #1 0x0 in ?? ()
# (gdb)
Is either fd1 or fd2 stdout? If so, printf() will write to them, and the
select call will time out. What happens if you add a timeout to your
select() call (5 seconds or so), and check if it timed out? If my
suspicions are correct, your program will wait 5 seconds then report that
the timeout expired.
From what I can tell, printf() is directly or indirectly touching fd1 or
fd2, causing select() to return. When you remove the printf(), fd1 and fd2
never get touched, so select() blocks indefinitely.
This is about as much as I can can glean from the fragment, and I could be
wrong ;-) Experiment with the select() call, and see what happens.
HTH.
--
Mo McKinlay T: +44 (0) 709 22 55 05 x1
Chief Software Architect F: +44 (0) 709 22 55 05 x3
inter/open E: mmckinlay@labs.interopen.org
A division of Bekon Marketing Limited W: http://www.interopen.org