From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Brian W. Harris" To: egcs-bugs@egcs.cygnus.com Cc: Tim Tait Subject: bug report Date: Tue, 31 Aug 1999 22:45:00 -0000 Message-id: X-SW-Source: 1999-08n/msg00726.html List-Id: The following typescript contains details of what we believe is a bug in the g++ compiler. As shown below the code runs fine for -g but fails for -O with a seg fault. OS = RedHat 6.0 on Pentium III Script started on Thu Aug 19 14:36:07 1999 [.tcshrc] <1 pcl11->test> g++ -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) <2 pcl11->test> cat main.cpp #include #include using namespace std; class vegasrun { public: vegasrun( int, int, int ); ~vegasrun() {}; private: int ndim, itmx, ncall; }; vegasrun::vegasrun( int nd, int its, int pts ) { ndim = nd; itmx = its; ncall = pts; } int main() { vegasrun born( 10, 4, 400 ); cout << endl << "Known answer = " << pow( 1.0-exp(-1.0), 2 ) << endl; return 0; } <3 pcl11->test> g++ -g -Wall main.cpp <4 pcl11->test> a.out Known answer = 0.399576 <5 pcl11->test> g++ -O main.cpp <6 pcl11->test> a.out Segmentation fault (core dumped) <7 pcl11->test> g++ -O -ffloat-store main.cpp <8 pcl11->test> a.out Known answer = 0.399576 <9 pcl11->test> exit exit Script done on Thu Aug 19 14:37:27 1999 Brian --------------------------------------------------------------- Brian Harris e-mail: harris@hep.anl.gov Argonne National Laboratory 9700 So. Cass Ave., Bldg. 362, HEP Office: +1-630-252-6965 Argonne, IL 60439 FAX: +1-630-252-5047 USA Home: +1-630-236-3968 ---------------------------------------------------------------