metz@iam.unibe.ch (Igor Metz) (12/18/89)
Configuration: Sun-4 SunOS 4.0.3 g++ 1.36.2 from interviews.stanford.edu libg++ 1.36.1 from prep.ai.mit.edu Problem: g++ loops or dumps core (fatal signal 6) Consider the following code --------------------------------------------- class BinTree { protected: short d; short n; public: BinTree(short dim, short N); BinTree(short dim, short N) { if ((dim*N + 1) <= 100) { d = dim; n = N; } }; }; int main() { BinTree b(3,2); } --------------------------------------------- Compiling this gives: g++ version 1.36.2 (based on GCC 1.36) /usr/local/lib/1.36.2/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ gaga2.cc /usr/tmp/cca17997.cpp GNU CPP version 1.36 /usr/local/lib/1.36.2/gcc-cc1plus /usr/tmp/cca17997.cpp -quiet -dumpbase gaga2.cc -version -o /usr/tmp/cca17997.s GNU C++ version 1.36.2 (based on GCC 1.36) (sparc) compiled by GNU C version 1.36. default target switches: -mfpu -mepilogue newg++: Program cc1plus got fatal signal 6. Sometimes the compiler dumps core, sometimes it loops!!! If I transform the code to --------------------------------------------- class BinTree { protected: short d; short n; public: BinTree(short dim, short N); }; BinTree::BinTree(short dim, short N) { if ((dim*N + 1) <= 100) { d = dim; n = N; } }; int main() { BinTree b(3,2); } --------------------------------------------- it compiles without any errors. Igor Metz X400: metz@iam.unibe.ch Institut fuer Informatik ARPA: metz%iam.unibe.ch@relay.cs.net und angewandte Mathematik UUCP: ..!uunet!mcvax!iam.unibe.ch!metz Universitaet Bern Phone: (0041) 31 65 49 90 Switzerland Fax: (0041) 31 65 39 65