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]

oper<< causes ICE 107


Hello,

I have come across a compiler bug, "Internal compiler error 107."  I've
managed to reduce the offending code to a small compilation unit, which is
attached below along with the compiler messages.  This bug does not occur
in 1.0.1, but it does appear in both 1.0.2 and 1.0.3a.  The architecture is
sparc-sun-solaris2.6, but I've also seen the bug on Solaris 2.5.1.

If the override of operator<< is removed, the code compiles without error.
Likewise, if the template instantiation line at the end is removed, or the
use of operator<< (ostream &, const char *) is changed to something other
than (const char *) in the BTreeNode<K,T>::print() method, then there are
no errors.

I've tried running the compiler under a debugger and trying to decipher all
of the 'tree' structures, but I'll admit it will take me alot of effort to
understand it.  If this seems fit to be added to the regression test suite,
point me in that direction and I'll learn how to add it.

Of course, I owe you the obligatory but much-deserved thanks for a very
useful and helpful compiler.  Thanks for your help.  If I haven't given
enough information, please let me know.

Gary

--
Gary Granger				  granger@ncar.ucar.edu
National Center for Atmospheric Research  Ph: 303-497-8816  FAX: 303-497-8770


#include <iostream.h>

class SerialBuffer;

template <class T>
inline SerialBuffer & operator<< (SerialBuffer &sbuf, const T &t)
{ }

template <class K, class T> class BTree;

template <class K, class T>
class BTreeNode
{
public:
	BTreeNode (BTree<K,T> &t, int d);
	virtual ~BTreeNode ();

	ostream &print (ostream &out)
	{
		int indent = depth * 5;
		char s[indent+1];
		s[0] = 0;
		out << s;
		return (out);
	}

protected:

	BTree<K,T> &tree;		// Reference to our tree base
	int depth;			// Depth of this node
	int nkeys;			// Number of keys in this node
	K *keys;			// Every node has an array of keys
};

template class BTreeNode<long,long>;



/usr/local/egcs-1.0.3a-5.6/bin/g++ -Wall -Wno-return-type -g -v   -I/scr/steam/granger/zebra/include   -Dsun -DSVR4    -c Bug.cc
Reading specs from /usr/local/egcs-1.0.3a-5.6/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.90.29/specs
gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)
 /usr/local/egcs-1.0.3a-5.6/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.90.29/cpp -lang-c++ -v -I/scr/steam/granger/zebra/include -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -g -Wall -Wno-return-type -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) -Dsun -DSVR4 Bug.cc /var/tmp/ccgFqus_.ii
GNU CPP version egcs-2.90.29 980515 (egcs-1.0.3 release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /scr/steam/granger/zebra/include
 /usr/local/egcs-1.0.3a-5.6/include/g++
 /usr/local/include
 /usr/local/egcs-1.0.3a-5.6/sparc-sun-solaris2.6/include
 /usr/local/egcs-1.0.3a-5.6/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.90.29/include
 /usr/include
End of search list.
 /usr/local/egcs-1.0.3a-5.6/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.90.29/cc1plus /var/tmp/ccgFqus_.ii -quiet -dumpbase Bug.cc -g -Wall -Wno-return-type -version -o /var/tmp/ccgFqus_.s
GNU C++ version egcs-2.90.29 980515 (egcs-1.0.3 release) (sparc-sun-solaris2.6) compiled by GNU C version egcs-2.90.29 980515 (egcs-1.0.3 release).
Bug.cc: In method `class ostream & BTreeNode<long int,long int>::print(class ostream &)':
Bug.cc:93: Internal compiler error 107.
Bug.cc:93: Please submit a full bug report to `egcs-bugs@cygnus.com'.


/usr/local/egcs-1.0.2/bin/g++ -Wall -Wno-return-type -g -v   -I/scr/steam/granger/zebra/include   -Dsun -DSVR4    -c Bug.cc
Reading specs from /usr/local/egcs-1.0.2/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
 /usr/local/egcs-1.0.2/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.27/cpp -lang-c++ -v -I/scr/steam/granger/zebra/include -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -g -Wall -Wno-return-type -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) -Dsun -DSVR4 Bug.cc /var/tmp/cc0sl7ti.ii
GNU CPP version egcs-2.90.27 980315 (egcs-1.0.2 release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /scr/steam/granger/zebra/include
 /usr/local/egcs-1.0.2/include/g++
 /usr/local/include
 /usr/local/egcs-1.0.2/sparc-sun-solaris2.5.1/include
 /usr/local/egcs-1.0.2/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.27/include
 /usr/include
End of search list.
 /usr/local/egcs-1.0.2/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.27/cc1plus /var/tmp/cc0sl7ti.ii -quiet -dumpbase Bug.cc -g -Wall -Wno-return-type -version -o /var/tmp/cc0sl7ti.s
GNU C++ version egcs-2.90.27 980315 (egcs-1.0.2 release) (sparc-sun-solaris2.5.1) compiled by GNU C version 2.7.2.
Bug.cc: In method `class ostream & BTreeNode<long int,long int>::print(class ostream &)':
Bug.cc:93: Internal compiler error 107.
Bug.cc:93: Please submit a full bug report to `egcs-bugs@cygnus.com'.


ale|491|% make Bug.o CXX=/scr/pigpen/granger/egcs-1.0.1/bin/g++
/scr/pigpen/granger/egcs-1.0.1/bin/g++ -Wall -Wno-return-type -g -v   -I/scr/steam/granger/zebra/include   -Dsun -DSVR4    -c Bug.cc
Reading specs from /scr/pigpen/granger/egcs-1.0.1/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.23/specs
gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)
 /scr/pigpen/granger/egcs-1.0.1/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.23/cpp -lang-c++ -v -I/scr/steam/granger/zebra/include -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -g -Wall -Wno-return-type -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) -Dsun -DSVR4 Bug.cc /var/tmp/ccBGyWH_.ii
GNU CPP version egcs-2.90.23 980102 (egcs-1.0.1 release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /scr/steam/granger/zebra/include
 /scr/pigpen/granger/egcs-1.0.1/include/g++
 /usr/local/include
 /scr/pigpen/granger/egcs-1.0.1/sparc-sun-solaris2.5.1/include
 /scr/pigpen/granger/egcs-1.0.1/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.23/include
 /usr/include
End of search list.
 /scr/pigpen/granger/egcs-1.0.1/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.23/cc1plus /var/tmp/ccBGyWH_.ii -quiet -dumpbase Bug.cc -g -Wall -Wno-return-type -version -o /var/tmp/ccBGyWH_.s
GNU C++ version egcs-2.90.23 980102 (egcs-1.0.1 release) (sparc-sun-solaris2.5.1) compiled by GNU C version egcs-2.90.23 980102 (egcs-1.0.1 release).
 /usr/ccs/bin/as -V -Qy -s -o Bug.o /var/tmp/ccBGyWH_.s
/usr/ccs/bin/as: WorkShop Compilers 4.X dev 18 Sep 1996


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