🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by "Douglas C. Schmidt" Fri, 30 Sep 1988 20:05
g++ 1.27 gets fatal signal on sparc.
#1462
Author: "Douglas C. Schmidt"
Date: Fri, 30 Sep 1988 20:05
86 lines
2879 bytes
Hi,

  The following program gets a fatal signal when compiled with g++
1.27 running on the sparc.  I've indicated the problem with a comment
in the code below.

Here's the code:

----------------------------------------
# 1 "bug.cc"
# 1 "/usr/public/lib/g++/g++-include/setjmp.h"
static const int _JBLEN = 15;
typedef int jmp_buf[_JBLEN];
extern int setjmp(jmp_buf);
extern void longjmp(jmp_buf, int);
# 1 "bug.cc"
const int TRIVIAL_ERROR = 1;
class cleanup_obj {
   friend class error_handler;
   static cleanup_obj* cleanup_obj_head;
   cleanup_obj *prev;
   cleanup_obj *next;   
protected:
   cleanup_obj(): prev(0),next(cleanup_obj_head) {
      if (next) {
         next->prev = this;
      }
      cleanup_obj_head = this;
   }
   ~cleanup_obj() {
      cleanup();
   }
   virtual void cleanup() {
      if (prev) {
         prev->next = next;
      }
      else {
         cleanup_obj_head = next;
      }
      if (next) {
         next->prev = prev;
      }      
   }
};
typedef int error_function(int err_num,class error_handler *ehp);
class error_handler : public cleanup_obj {
   friend void report_error(int err_num); 
   static error_handler *top_of_stack;
   error_handler *next;
   error_function *func;
public:
   jmp_buf abort_label;
   error_handler(error_function err_func = 0):   

// change error_function to error_function * and problem goes away!

      next(top_of_stack), func(err_func) {
      top_of_stack = this;
   }
   void cleanup() {
      top_of_stack = next;
      cleanup_obj::cleanup();
   }
   void abort(int ret_val) {
      while ((cleanup_obj::cleanup_obj_head) &&
             (cleanup_obj::cleanup_obj_head != this)) {
         cleanup_obj::cleanup_obj_head->cleanup();
      }
      longjmp(abort_label,ret_val);
   }
   void operator=(error_function *err_func) {
      func = err_func;
   }
};
----------------------------------------

Here's the diagnostic:

----------------------------------------
g++ version 1.27.0
 /usr/public/lib/g++/gcc-cpp+ -v -I/cd/ua/schmidt/include/ -undef -D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix bug.cc /tmp/cca00426.cpp
GNU CPP version 1.27.0
 /usr/public/lib/g++/gcc-c++ /tmp/cca00426.cpp -quiet -dumpbase bug.cc -fchar-charconst -noreg -version -o /tmp/cca00426.s
GNU C++ version 1.27.0 (sparc) compiled by GNU C version 1.28.
/usr/public/g++: Program c++ got fatal signal 6.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads