This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
run-time g++ bug
- To: bug-gcc at gnu dot org
- Subject: run-time g++ bug
- From: Steven Homolya <steven dot homolya at sci dot monash dot edu dot au>
- Date: Thu, 31 Aug 2000 14:59:52 +1100
- Organization: Monash University
The attached segfault.c++ compiles with no errors, but the executable
terminates with a segmentation fault when compiled with optimisations
on, i.e:
g++ -O -o tsf test-segfault.c++
but runs fine when compiled without the -O flag.
I'm using version egcs-2.91.66 under Red Hat 6.0.
Please take a look at the attached file; it is only 12 lines of simple
code with nothing to warrant any run-time errors.
Steve
PS. If you can spare I would really appreciate some feedback on this
problem.
#include <iostream.h>
#include <math.h>
class C{
public:
double *p;
int N;
double *mu;
C();
};
C::C():p(NULL), N(0), mu(NULL){}
void main(){
C c;
double a = pow(2,2);
cout << a;
}