GCC 2.95.2 / C++

Johan Wärlander jwarlander@hotmail.com
Thu Mar 9 15:39:00 GMT 2000


I encountered a bug when I changed the definition of iStart from int to 
unsigned int, in the piece of code below:

//------------------------------------------------------------------

bool Descriptor::read ()
{
    ///////////////////////////////////////////////////////////
    // The changed variable that apparently introduced bug:
    //

    unsigned int iStart;


    /* Hold horses if pending command already. */
    if ('\0' != incomm[0])
      return true;

    /* Check for overflow. */
    iStart = strlen (inbuf);
    if (iStart >= sizeof (inbuf) - 10)
    {
        log_printf ("%s input overflow!", host);
        this->write ("\n\r*** DON'T SPAM!!! ***\n\r", 0);
        return false;
    }

    /* Snarf input. */

    for ( ; ; )
    {
        int nRead;

        nRead = ::read (descriptor, inbuf + iStart,
                      sizeof (inbuf) - 10 - iStart);

        if (0 < nRead)
        {
            iStart += nRead;

            /////////////////////////////////////////////////////////
            // BUG appears to have occured at the following line:
            //

            if ('\n' == inbuf[iStart - 1] || '\r' == inbuf[iStart - 1])
              break;
        }
        else if (0 == nRead)
        {
            log_string ("EOF encountered on read.");
            return false;
        }
        else if (EWOULDBLOCK == errno)
        {
          break;  // If there is nothing to read, dont try
        }
        else
        {
            perror ("Read_from_descriptor");
            return false;
        }
    }

    inbuf[iStart] = '\0';

    return true;
}


//------------------------------------------------------------------


[fain@khaanikel src_marroc]$ g++ -v --save-temps -c -g -Wall -I. 
-I/usr/include/pgsql -o obj/Descriptor.o Descriptor.cc
Reading specs from 
/home/fain/apps/bin/../lib/gcc-lib/i686-pc-linux-gnu/2.96/specs
gcc version 2.96 20000228 (experimental)
/home/fain/apps/bin/../lib/gcc-lib/i686-pc-linux-gnu/2.96/cpp -lang-c++ -v 
-I.
-I/usr/include/pgsql -iprefix 
/home/fain/apps/bin/../lib/gcc-lib/i686-pc-linux-gnu/2.96/ -D__GNUC__=2 
-D__GNUG__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__cplusplus 
-D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix
-D__linux -Asystem(posix) -D__EXCEPTIONS -g -Wall -Acpu(i386) 
-Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_pentiumpro__ 
Descriptor.cc Descriptor.ii
GNU CPP version 2.96 20000228 (experimental) (cpplib)
(i386 Linux/ELF)
ignoring duplicate directory `/home/fain/apps/include/g++-3'
ignoring duplicate directory `/home/fain/apps/i686-pc-linux-gnu/include'
ignoring duplicate directory 
`/home/fain/apps/lib/gcc-lib/i686-pc-linux-gnu/2.96/include'
#include "..." search starts here:
#include <...> search starts here:
.
/usr/include/pgsql
/home/fain/apps/include/g++-3
/home/fain/apps/i686-pc-linux-gnu/include
/home/fain/apps/lib/gcc-lib/i686-pc-linux-gnu/2.96/include
/home/fain/apps/include
/usr/include
End of search list.
/home/fain/apps/bin/../lib/gcc-lib/i686-pc-linux-gnu/2.96/cc1plus 
Descriptor.ii -quiet -dumpbase Descriptor.cc -g -Wall -version -o 
Descriptor.s
GNU C++ version 2.96 20000228 (experimental) (i686-pc-linux-gnu) compiled by 
GNU C version pgcc-2.91.66 19990314 (egcs-1.1.2 release).
Descriptor.cc: In method `bool Descriptor::read ()':
Descriptor.cc:87: Internal compiler error in `size_binop', at
Descriptor.cc:87: fold-const.c:1873
Descriptor.cc:87: Please submit a full bug report.
Descriptor.cc:87: See <URL: http://www.gnu.org/software/gcc/bugs.html >
Descriptor.cc:87: for instructions.


//-------------------------------------------------------------------

I hope this helps, meanwhile I'll just revert to int.

Regards,
Johan Wärlander

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com



More information about the Gcc-bugs mailing list