The following code crashes g++ 4.1.3 :
*********START OF FILE************** #include <iostream> using namespace std; double arctan(double x) { int i=1,n=20; double c=1.0,arct=0.0,paf=1.0,eps=0.00001,hab; hab=(x/(1+x*x)); do { arct+=paf; c+=2i/(2i+1); paf=(c*hab); i++; } while((i<n)||(paf>eps)); arct*=hab; return arct; } int main() { double Pi; Pi=4*(4*arctan(1/5)-arctan(1/239)); cout<<Pi<<endl; } ********* END OF FILE ************** And here's the output of g++ : [EMAIL PROTECTED]:/tmp$ g++ -v test.cpp Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2) /usr/lib/gcc/i486-linux-gnu/4.1.3/cc1plus -quiet -v -D_GNU_SOURCE test.cpp -quiet -dumpbase test.cpp -mtune=generic -auxbase test -version -fstack-protector -fstack-protector -o /tmp/ccQX7fQO.s ignoring nonexistent directory "/usr/local/include/i486-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../i486-linux-gnu/include" ignoring nonexistent directory "/usr/include/i486-linux-gnu" #include "..." search starts here: #include <...> search starts here: /usr/include/c++/4.1.3 /usr/include/c++/4.1.3/i486-linux-gnu /usr/include/c++/4.1.3/backward /usr/local/include /usr/lib/gcc/i486-linux-gnu/4.1.3/include /usr/include End of search list. GNU C++ version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2) (i486-linux-gnu) compiled by GNU C version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 3cc47be363985179cfafdceddd0e8f5d test.cpp: In function double arctan(double): test.cpp:12: internal compiler error: in const_binop, at fold-const.c:1641 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. For Debian GNU/Linux specific bug reporting instructions, see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>. Preprocessed source stored into /tmp/cczf63dY.out file, please attach this to your bugreport. -- Summary: g++ crashes on simple 20-line source file Product: gcc Version: 4.1.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: nmaquet at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34086