From 28efe441f0e1c06790f306c158ccc2c0e0c2f1bd Mon Sep 17 00:00:00 2001 From: jamborm Date: Wed, 25 Feb 2009 17:34:40 +0000 Subject: [PATCH] 2009-02-25 Martin Jambor * tree-inline.c (initialize_cfun): Remove asserts for calls_setjmp and alls_alloca function flags. (copy_bb): Set calls_setjmp and alls_alloca function flags if such calls are detected. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144428 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 +++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/torture/pr39259.C | 40 ++++++++++++++++++++++++++++++++++ gcc/tree-inline.c | 12 ++++++---- 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr39259.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cb0b440..2aa1030 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2009-02-25 Martin Jambor + + PR tree-optimization/39259 + * tree-inline.c (initialize_cfun): Remove asserts for calls_setjmp and + alls_alloca function flags. + (copy_bb): Set calls_setjmp and alls_alloca function flags if such + calls are detected. + 2009-02-25 Paolo Bonzini * regmove.c (discover_flags_reg, flags_set_1, mark_flags_life_zones, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 00a2ce9..4e54e54 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-02-25 Martin Jambor + PR tree-optimizations/39259 + * g++.dg/torture/pr39259.C: New testcase. + 2009-02-24 Richard Guenther PR c++/39242 diff --git a/gcc/testsuite/g++.dg/torture/pr39259.C b/gcc/testsuite/g++.dg/torture/pr39259.C new file mode 100644 index 0000000..256181f --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr39259.C @@ -0,0 +1,40 @@ +// PR tree-optimization/39259 +// { dg-do compile } +// { dg-options "-O2" } + + +extern "C" int __mysetjmp () __attribute__ ((__returns_twice__)); + +class TContStatus {}; + +class TContEvent +{ +public: + inline void Execute () throw(); +}; + +class TCont +{ +public: + TContStatus ReadD (void* buf, int deadline) + { + TContEvent event; + event.Execute (); + return TContStatus(); + } + TContStatus ReadI (void *buf) + { + return ReadD (buf, 1); + } +}; + +void TContEvent::Execute () throw () +{ + __mysetjmp(); +} + +void Broken (TCont *mCont) +{ + mCont->ReadI(0); + mCont->ReadI(0); +} diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 075e575..fd4443c 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1398,6 +1398,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, { struct cgraph_node *node; struct cgraph_edge *edge; + int flags; switch (id->transform_call_graph_edges) { @@ -1429,6 +1430,13 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, default: gcc_unreachable (); } + + flags = gimple_call_flags (stmt); + + if (flags & ECF_MAY_BE_ALLOCA) + cfun->calls_alloca = true; + if (flags & ECF_RETURNS_TWICE) + cfun->calls_setjmp = true; } /* If you think we can abort here, you are wrong. @@ -1745,10 +1753,6 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count, gcc_assert (cfun->cfg == NULL); gcc_assert (cfun->decl == new_fndecl); - /* No need to copy; this is initialized later in compilation. */ - gcc_assert (!src_cfun->calls_setjmp); - gcc_assert (!src_cfun->calls_alloca); - /* Copy items we preserve during clonning. */ cfun->static_chain_decl = src_cfun->static_chain_decl; cfun->nonlocal_goto_save_area = src_cfun->nonlocal_goto_save_area; -- 2.7.4