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 (egcs-2.91.66)



Just hit another internal compiler error.  The input is sufficiently
different from the one that I posted about just before to suggest that the
problem might be somewhere else.

Thanks & best regards,
Christoph

PS:
In case you're wondering what the heck I'm trying to do; I'm looking for an
elegant generic implementation of a graph on top of which one can plug
adaptors (e.g.  to turn a plain graph into a weighted one with colored
nodes or whatever).  Trickyness arises out of the recursive nature of the
types.  It seems to me I need something along the lines of partial
evaluation of a `higher-order template', which I was trying to simulate
with nested member templates.  I actually found a solution similar to the
one below that works, but this one would be sligthly cleaner (if it
worked, and is actually legal C++, which I'm not entirely convinced of).


----- input (try1.cc):
struct GenericGraph {

    template<class _Node>
    struct Edge {
	typedef _Node* 		NodeRef;
	NodeRef			in;
    };

    template<class _Edge>
    struct Node {
	typedef _Edge*		EdgeRef;
	EdgeRef			e;
    };

};

template <class _BaseGraph>
struct ParamGraph {
    template <class _Node, class _Edge>
    struct ParamTypes {
	class Edge : public _BaseGraph::Edge<_Node> {};
	class Node : public _BaseGraph::Node<_Edge> {};
   };
};

typedef ParamGraph<GenericGraph> GenericGraphBase;

template <class _BaseGraph>
struct AttribGraph {
    template <class _Node, class _Edge>
    struct ParamTypes {
    	typedef typename _BaseGraph::ParamTypes<_Node, _Edge> Base;

	struct Edge : public Base::Edge {
	    int 		x;
	};
	struct Node : public Base::Node {
	    int		y;
	};
   };

};

/*
template <class _BaseGraph>
struct instantiateGraph {
    class Node;
    class Edge : public _BaseGraph::ParamTypes<Node, Edge>::Edge {};
    class Node : public _BaseGraph::ParamTypes<Node, Edge>::Node {};
};

typedef instantiateGraph<AttribGraph<GenericGraphBase> >  xGraph;
*/

struct instGraph {
    class Node;
    class Edge : public
    	AttribGraph<GenericGraphBase> :: ParamTypes<Node, Edge> :: Edge {};
    class Node : public
    	AttribGraph<GenericGraphBase> :: ParamTypes<Node, Edge> :: Node {};
};

int main()
{
    instGraph::Node n;
    instGraph::Edge* e;
    e = n.e;
    n.y = 15;
}


----- invocation:
ckern@meditate:~/work/c++-trials/bug-reports/intl-error2[1444] gcc -v try1.cc 
Reading specs from /home/ckern/tools/sun4sol/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
 /home/ckern/tools/sun4sol/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.66/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -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 -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) try1.cc /var/tmp/ccC8884k.ii
GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /home/ckern/tools/sun4sol/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.66/include/g++
 /home/ckern/tools/generic/include
 /home/ckern/tools/sun4sol/sparc-sun-solaris2.6/include
 /home/ckern/tools/sun4sol/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.66/include
 /usr/include
End of search list.
 /home/ckern/tools/sun4sol/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.66/cc1plus /var/tmp/ccC8884k.ii -quiet -dumpbase try1.cc -version -o /var/tmp/cc6fq9iB.s
GNU C++ version egcs-2.91.66 19990314 (egcs-1.1.2 release) (sparc-sun-solaris2.6) compiled by GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
try1.cc: In instantiation of `AttribGraph<ParamGraph<GenericGraph> >::AttribGraph<ParamGraph<GenericGraph> >::ParamTypes<instGraph::Node,instGraph::Edge>':
try1.cc:58:   instantiated from here
try1.cc:58: Internal compiler error.
try1.cc:58: Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.
try1.cc:58: See <URL:http://egcs.cygnus.com/faq.html#bugreport> for details.
ckern@meditate:~/work/c++-trials/bug-reports/intl-error2[1445] 


----- machine:
ckern@meditate:~/tools/src/gnu/egcs/egcs-1.1.2-build-sunos.2.6[1303] uname -a
SunOS meditate 5.6 Generic_105181-11 sun4u sparc


----- configure options:
ckern@meditate:~/tools/src/gnu/egcs/egcs-1.1.2-build-sunos.2.6[1305] cat ../config.sh 

ARCHBIN=`/home/ckern/bin/generic/arch`

.../egcs-1.1.2/configure  \
    --prefix=/home/ckern/tools/generic \
    --exec-prefix=/home/ckern/tools/$ARCHBIN  \
    --with-local-prefix=/home/ckern/tools/generic \
    --with-gnu-as \
    --with-gnu-ld \
    --with-stabs \
    --enable-version-specific-runtime-libs \
    --enable-languages=c++



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