egcs bug report

Nancy Hall nhall@cs.wisc.edu
Thu May 14 11:02:00 GMT 1998


Here's a problem that I've distilled down about as much as I can.
It sort of looks like an uninitialized variable bug, and I say
that simply because in the process of distilling it,
I came across various seemingly-unrelated ways to make the
compiler quit choking.  For example, in my original (undistilled) code,
my work-around amounts to moving the declaration of the variable
space_l (that to which I'm trying to assign a new[]-d structure)

from here:
	{
	    struct lockid_t space_l=0;
	    ...

	    if(...){
		space_l = new lockid_t[i];
	    } else {
		space_l = new lockid_t[j];
	    }
	    delete [] space_l;
	}
to here:
	{
	    ...

	    if(...){
		struct lockid_t space_l=0;
		space_l = new lockid_t[i];
		...
		delete [] space_l;
	    } else {
		struct lockid_t space_l=0;
		space_l = new lockid_t[j];
		...
		delete [] space_l;
	    }
	}

Details are below.
I'm at 608/262-5945 or nhall@cs.wisc.edu if you want/need more info.

Here's the distilled code, simple.cpp 

****************** simple.cpp ***********************
typedef unsigned int size_t;

class Y {
public:
    int x;
    Y() ;    
};

/*
 * At one point, if I changed the return type to int, 
 * it compiled, but that's no longer the case -- this
 * suggests uninitialized variable bug.  Now it chokes
 * whether return_type is int, Y, or w_rc_t (a complex
 * structure for which I do not include definition because
 * it now seems immaterial)
 */
#ifdef notdef
#include <w.h>
typedef w_rc_t return_type;
# else
typedef int return_type;
#endif


class X {
public:
     /*
      * If remove the overloaded delete & new
      * it compiles.  For that matter, the overloaded
      * new doesn't matter, it just chokes if the 
      * overloaded delete is there
      */
    void* operator new[](size_t s); 
    void  operator delete[](void* p, size_t s);
    int x;
    /*
     * doesn't seem to matter if it has a destructor,
     * but if I remove the constructor, it compiles
     */
     X() ;    
};

typedef X problem_t;
/* 
 * If I change the problem_t to int or Y, it compiles -
 * not surprisingly, since tweaking definition of X
 * lets it compile
 */


/*
 * If I change the definition of I to 5, it compiles
 */
#define I i

return_type 
testit()
{
    return_type rc;
    problem_t *space_l = 0;
    int i=5;
    space_l = new problem_t[I]; 
    i = 4;
    return rc;
}

****************** END simple.cpp ***********************
Here's how I compile it:

    /s/egcs/bin/gcc -x c++ simple.cpp

Here's what happens when I compile it:

    simple.cpp: In function `int testit()':
    simple.cpp:65: Internal compiler error.
    simple.cpp:65: Please submit a full bug report to `egcs-bugs@cygnus.com'.

Here are the details:
    Reading specs from /s/egcs-1.0.2/lib/gcc-lib/i386-pc-solaris2.5.1/pgcc-2.90.27/specs
    gcc version pgcc-2.90.27 980315 (egcs-1.0.2 release)
     /s/egcs-1.0.2/lib/gcc-lib/i386-pc-solaris2.5.1/pgcc-2.90.27/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -Di386 -Dunix -D__svr4__ -D__SVR4 -Dsun -D__i386__ -D__unix__ -D__svr4__ -D__SVR4 -D__sun__ -D__i386 -D__unix -D__sun -Asystem(svr4) -D__EXCEPTIONS -Di386 -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__i386__ -Asystem(unix) -Acpu(i386) -Amachine(i386) simple.cpp /var/tmp/cca0055M.ii
    GNU CPP version pgcc-2.90.27 980315 (egcs-1.0.2 release) (i386 System V Release 4)
    #include "..." search starts here:
    #include <...> search starts here:
     /s/egcs-1.0.2/include/g++
     /s/egcs-1.0.2/i386-pc-solaris2.5.1/include
     /s/egcs-1.0.2/lib/gcc-lib/i386-pc-solaris2.5.1/pgcc-2.90.27/include
     /usr/include
    End of search list.
     /s/egcs-1.0.2/lib/gcc-lib/i386-pc-solaris2.5.1/pgcc-2.90.27/cc1plus /var/tmp/cca0055M.ii -quiet -dumpbase simple.cc -version -o /var/tmp/cca0055M.s
    GNU C++ version pgcc-2.90.27 980315 (egcs-1.0.2 release) (i386-pc-solaris2.5.1) compiled by GNU C version pgcc-2.90.27 980315 (egcs-1.0.2 release).
    simple.cpp: In function `int testit()':
    simple.cpp:65: Internal compiler error.
    simple.cpp:65: Please submit a full bug report to `egcs-bugs@cygnus.com'.





More information about the Gcc-bugs mailing list