Internal error: Segmentation fault on gcc 3.0
Gustavo Romero López
gustavo@geneura.ugr.es
Mon Jul 9 10:27:00 GMT 2001
Hi,
Hope this help.
GCC version
-----------
fraguel:~/eo/bug$ /usr/local/gcc-3.0/bin/g++ -v
Reading specs from
/usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ./configure --prefix=/usr/local/gcc-3.0
Thread model: single
gcc version 3.0
system type
-----------
fraguel:~/eo/bug$ /usr/local/gcc-3.0/bin/g++ -v
Reading specs from
/usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ./configure --prefix=/usr/local/gcc-3.0
Thread model: single
gcc version 3.0
complete command line that triggers the bug
-------------------------------------------
/usr/local/gcc-3.0/bin/g++ -I. -I../eo -Wall -g -lm p2o.cc -o p2o
compiler output
---------------
/usr/local/gcc-3.0/bin/g++ -Wall -g p2o.cc -o p2o
p2o.cc: In function `int main()':
p2o.cc:57: warning: unused variable `eo<XY, float, fitness2, f2, true>
eo2'
p2o.cc:58: warning: unused variable `eo<XY, float, fitness3, f3, true>
eo3'
p2o.cc: In constructor `eo<A, B, C, c, d>::eo() [with A = XY, B = float,
C =
fitness2, C&c = f2, bool d = true]':
p2o.cc:57: instantiated from here
p2o.cc:10: Internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.
make: *** [p2o] Error 1
preprocessed file
-----------------
not attached because your mail queue only accepts emails < 400KB:
p2o.ii p2o.s
options given when GCC was configured/built
-------------------------------------------
./configure --prefix=/usr/local/gcc-3.0
the (tiny) source code
----------------------
attached: p2c.cc
thanks for your time
Gustavo
--
Gustavo Romero López
Departamento de Arquitectura y TecnologÃÂa de Computadores
Universidad de Granada
#include <iostream>
using namespace std;
template <class A, class B, class C, C& c, bool d> class eo: public A
{
public:
eo()
{
cout << this->x << " " << this->y << " "
<< c(*this) << " "
<< ((d)?"true":"false") << endl;
}
private:
B b;
};
struct XY
{
float x, y;
XY(): x(1), y(0.1) {}
};
float fitness(const XY& a)
{
return a.x + a.y;
}
struct fitness2
{
float operator()(const XY& a)
{
return a.x - a.y;
}
float f(const XY& a)
{
return a.x - a.y;
}
};
struct fitness3
{
float operator()(const XY& a)
{
return a.x / a.y;
}
};
fitness2 f2;
fitness3 f3;
int main()
{
eo<XY, float, fitness2, f2, true> eo2;
eo<XY, float, fitness3, f3, true> eo3;
return 0;
}
More information about the Gcc-bugs
mailing list