Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2013 16:49:41 +0100
From:      Stefan Farfeleder <stefanf@FreeBSD.org>
To:        Dimitry Andric <dim@FreeBSD.org>
Cc:        freebsd-current@freebsd.org, Nathan Whitehorn <nwhitehorn@freebsd.org>
Subject:   Re: clang 3.2 RC2 miscompiles libgcc?
Message-ID:  <20130104154940.GD1430@mole.fafoe.narf.at>
In-Reply-To: <20130102135950.GA1464@mole.fafoe.narf.at>
References:  <20121227150724.GA1431@mole.fafoe.narf.at> <50DC65F5.6060004@freebsd.org> <50E0BD66.4070609@FreeBSD.org> <20130102135950.GA1464@mole.fafoe.narf.at>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 02, 2013 at 02:59:50PM +0100, Stefan Farfeleder wrote:
> On Sun, Dec 30, 2012 at 11:17:10PM +0100, Dimitry Andric wrote:
> > 
> > I have been playing with Stefan's testcase for a while now, and while I
> > can reproduce the crashes, I am still at a loss about the cause.  It
> > does seem to have something to do with throwing exceptions, but I am
> > still not sure whether I am looking at a bug in boost, gcc, clang, or
> > libgcc...
> > 
> > Do you happen to have a smaller testcase, by any chance?
> 
> Not yet, but I'll try to come up with something smaller.

Here's a minimal test case that reproduces the bug:

$ cat throw-crash.cc
#include <stdexcept>

void f2(void) {
    std::string s;
    throw std::runtime_error("foo");
}

void f1(void) {
    f2();
}

int main(void) {
    try {
        std::string s1, s2;
        f1();
        return 0;
    } catch (const std::exception &) {
        return 1;
    }
}
$ g++ -O2 -finline-limit=0 throw-crash.cc 
$ ./a.out 
zsh: bus error (core dumped)  ./a.out

Stefan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130104154940.GD1430>