This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

internal compiler error


/*
 * gcc-2.95.2 bug demonstration program
 * (gcc gets internal compiler error!!)
 * 
 * written by Wolfgang Wieser (wwieser@gmx.de)
 *
 * Although this is my intellectual property I claim 
 * no Copyright on it :)
 * 
 */

class Drawing   /* just any class */
{
	private:
		int _CalcRadPix(int);   /* three member functions */
		int _CalcRadFix(int);
		int _CalcRadZco(int);
	public:
		Drawing();
};

/* _CalcRadFunc is the type ``pointer to int(int) member 
 * function of class Drawing'' */
typedef int (Drawing::*_CalcRadFunc)(int);

Drawing::Drawing()
{
	/* (try to) initailize an array of 3 pointers to functions */
    _CalcRadFunc tmp[3]=
    {
#if 1  /* FIRST METHOD (see below) */
		&_CalcRadPix,
		&_CalcRadFix,
		&_CalcRadZco
#else  /* SECOND METHOD */
		&Drawing::_CalcRadPix,
		&Drawing::_CalcRadFix,
		&Drawing::_CalcRadZco
#endif
    };
	/* prevent tmp[] from being rationalized away (if needed). */
	memcpy(NULL,tmp,0);
}


int main(int,char **)
{
	Drawing drw;  // call constructor
	
	return(0);
}


/*
** FIRST METHOD: gcc output: (gcc gccbug.cc -o gccbug) **
gccbug.cc: In method `Drawing::Drawing(int)':
gccbug.cc:25: taking the address of a non-static member function
gccbug.cc:25:   to form a pointer to member function, say
`&Drawing::_CalcRadPix'
gccbug.cc:26: taking the address of a non-static member function
gccbug.cc:26:   to form a pointer to member function, say
`&Drawing::_CalcRadFix'
gccbug.cc:33: taking the address of a non-static member function
gccbug.cc:33:   to form a pointer to member function, say
`&Drawing::_CalcRadZco'
gccbug.cc:33: Internal compiler error in `const_hash', at varasm.c:2372
Please submit a full bug report.

-- ok,ok... we do what gcc suggests (replace ``#if 1'' by ``#if 0'')

** SECOND METHOD: gcc output: **
gccbug.cc: In method `Drawing::Drawing(int)':
gccbug.cc:33: Internal compiler error in `const_hash', at varasm.c:2372
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport> for
instructions.

*/

-- 
Sent through GMX FreeMail - http://www.gmx.net


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]