This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Mainline regression] ICE when throwing strings




--On Thursday, October 24, 2002 12:23:23 PM +0200 Reichelt <reichelt@igpm.rwth-aachen.de> wrote:

Hi,

we already have at least 4 PRs for this problem, so I just wanted to
bring it to attention in order to prevent GNATS from getting flooded with
more PRs of the same issue.

Throwing an exception that uses strings will cause an ICE on
mainline (just compile with g++ -O):

----------------------snip here--------------------
#include<string>

struct C
{
    C (std::string) {}
};

void foo ()
{
    throw C(std::string());
}
----------------------snip here--------------------

A reduced testcase can be found in PR 8186 and PR 7959.
PR 8325 and PR 8244 are probably the same bug.
I know exactly what is causing this; Jason wrote some code to elide
copy constructors in this situation and it doesn't play nice with
inlining.  -fno-elide-constructors is a work-around.

Jason knows about the bug and will fix it when he is no longer at the
C++ standards meeting.

If you want, test replacing "flag_elide_constructors" with "false" in
stabilize_throw_expr; if that passes, you can go ahead and check it in
on the mainline.  That should disable the new optimization and avoid the
bug.

--
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]