Article View: gnu.g++.bug
Article #1462g++ 1.27 gets fatal signal on sparc.
From: "Douglas C. Schmidt"
Date: Fri, 30 Sep 1988 20:05
Date: Fri, 30 Sep 1988 20:05
86 lines
2879 bytes
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.
Technical Details
Message-ID:
<8809301305.aa06682@PARIS.ICS.UCI.EDU>Path:
arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%siam.ics.uci.eduShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%siam.ics.uci.edu
From: schmidt%siam.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt")
Newsgroups: gnu.g++.bug
Subject: g++ 1.27 gets fatal signal on sparc.
Message-ID: <8809301305.aa06682@PARIS.ICS.UCI.EDU>
Date: 30 Sep 88 20:05:40 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 86