This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/5238: Exceptions work in 3.0.2, not in 3.0.3
- From: swansma at yahoo dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 2 Jan 2002 02:47:48 -0000
- Subject: c++/5238: Exceptions work in 3.0.2, not in 3.0.3
- Reply-to: swansma at yahoo dot com
>Number: 5238
>Category: c++
>Synopsis: Exceptions work in 3.0.2, not in 3.0.3
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jan 01 18:56:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: swansma@yahoo.com
>Release: gcc version 3.0.3
>Organization:
>Environment:
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.0.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share/gcc-3.0.3 --enable-shared --enable-threads=posix --disable-checking --enable-long-long --enable-cstdio=stdio --enable-clocale=generic --enable-languages=c,c++,f77,objc,java --program-suffix=-3.0.3 --enable-objc-gc --host=i586-mandrake-linux-gnu
Thread model: posix
gcc version 3.0.3 (Mandrake Linux 8.2 3.0.3-1mdk)
>Description:
Exception handling in 3.0.2 works, in 3.0.3 it fails.
I could not make the example below fail when everything
was in one file, so I kept it split up into three small
files.
>How-To-Repeat:
CPP = gcc-3.0.3
CPPFLAGS = -g -fPIC -D_REENTRANT -DDEBUG -D_GNU_SOURCE
exTest: exTest.cpp LogTest.h LogTest.o TestException.h
${CPP} exTest.cpp -o exTest ${CPPFLAGS} LogTest.o
LogTest.o: LogTest.cpp LogTest.h TestException.h
${CPP} LogTest.cpp -c -o LogTest.o ${CPPFLAGS}
******** TestException.h **********
#ifndef _EXCEPTION_H
#define _EXCEPTION_H
#include <string.h>
class TestException {
protected:
char msg[1024];
public:
TestException(const char *errorMessage) {
strcpy(msg, errorMessage);
}
};
#endif
******* LogTest.h **********
#ifndef _LOG_H
#define _LOG_H
#include "TestException.h"
class LogTest {
protected:
public:
LogTest();
~LogTest() {};
//void init(const char* logFile, bool truncate, bool doChown=true)
//void init(const char* logFile, bool truncate)
//void init(const char* logFile)
void init()
throw(TestException);
};
#endif
********* LogTest.cpp ***********
#include "LogTest.h"
LogTest::LogTest() {
}
//void LogTest::init(const char* logName, bool truncate, int doChown)
//void LogTest::init(const char* logName, bool truncate)
void LogTest::init()
throw(TestException) {
throw TestException("Log blah");
}
******** exTest.cpp *********
#include <stdio.h>
#include <string.h>
#include "LogTest.h"
int main(int argc, char** argv) {
LogTest log;
try {
log.init(); // aborts
//log.init("msg"); // aborts
//log.init("msg", true); // aborts
//log.init("msg", true, true); // aborts
} catch(TestException e) {
printf("caught\n");
}
return 0;
}
Use the make targets provided.
./exTest
will abort.
>Fix:
downgrade to 3.0.2
>Release-Note:
>Audit-Trail:
>Unformatted: