internal compiler error in C++ front end
Joe Buck
jbuck@synopsys.com
Sun Sep 28 15:49:00 GMT 1997
The following program blows up egcs (every version since at least 970910
through the present version):
#include <vector>
vector<int> v(3,5);
I've verified that the crash occurs on both Linux and Solaris/sparc.
The message is
/usr/local/egcs/include/g++/vector.h:103: Internal compiler error 97.
/usr/local/egcs/include/g++/vector.h:103: Please submit a full bug report
to `egcs-bugs@cygnus.com'.
vector<double> v(5, 3.0);
works fine.
vector<double> v(3.0, 5);
is quietly accepted, but seems bogus. I suppose the compiler can
assume InputIterator == double, but this seems strange.
does not crash, but
vector<double> v(3, 5);
does: so does the illegal
vector<double> v(3.0, 3.0);
It seems that there is some confusion between vector<T>(size_type,const T&)
and the template member vector<T>(Iterator,Iterator). The odd thing
is that for vector<int>(32,3) the second seems in some ways a better match,
but STL is banking on the first one being chosen! (to get a vector of
32 elements with value 3).
While it's likely that this particular case would not have been
caught, this does suggest that the libstdc++ tests are too weak; tvector
does not try out even 1/10 of the vector class functionality. Tests that
at least call each method of vector (and the other STL classes) at least
once would be a great help. (Perhaps others already have something: the
ObjectSpace free tests seem too weak).
More information about the Gcc
mailing list