public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/5238: Exceptions work in 3.0.2, not in 3.0.3
@ 2002-04-01 23:22 rth
  0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2002-04-01 23:22 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, swansma

Synopsis: Exceptions work in 3.0.2, not in 3.0.3

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Mon Apr  1 23:22:38 2002
State-Changed-Why:
    Fixed for gcc 3.0.4.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5238


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/5238: Exceptions work in 3.0.2, not in 3.0.3
@ 2002-01-01 18:56 swansma
  0 siblings, 0 replies; 2+ messages in thread
From: swansma @ 2002-01-01 18:56 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-04-02  7:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-01 23:22 c++/5238: Exceptions work in 3.0.2, not in 3.0.3 rth
  -- strict thread matches above, loose matches on Subject: below --
2002-01-01 18:56 swansma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).