wierd compile bug

Nic Ferrier nferrier@tapsellferrier.co.uk
Fri Jul 6 13:44:00 GMT 2001


I think I've found an interesting compile bug with the C++ code and I
need a bit of help:

1. identifying whether it *might* be caused by compilation switches

2. working out who to send it to



The bug is in the close() member function of my patched
natPlainSocketImpl.cc

Here it is:


  //close (shutdown) the socket
  void
  java::net::PlainSocketImpl::close ()
  {
     int res = ::close (fnum);

    if(res==-1)
      printf("\nclosing %d got errno: %d\n", fnum, errno);

    //reset the socket fd
    fnum = -1;

    if (res == -1 && !(errno == ENOTCONN))
      throw new java::io::IOException( 
              JvNewStringUTF (strerror (errno)));
  }


The bug is really strange, the file handle fnum is being set to -1
before ::close() is called.

I have checked that no other code is doing it (by commenting out the
assignment to fnum in this m-f) and I'm absolutely sure that this must
be what is happening.

I can't see why g++ might do that, it must be able to tell that the
value is being used in the call to ::close().


So, does anyone think this might be a compile switch getting over
enthusiastic?

Or should I report it as a fault? If so to whom?


Nic



More information about the Java mailing list