Commit 5cefa0d9 by Jason Merrill Committed by Jason Merrill

re PR tree-optimization/17697 (ICE: Statement marked for throw, but doesn't - verify_stmts failed)

        PR tree-optimization/17697
        * decl.c (duplicate_decls): Copy TREE_NOTHROW from newdecl to olddecl.

From-SVN: r88293
parent d962e7ad
2004-09-29 Jason Merrill <jason@redhat.com>
PR tree-optimization/17697
* decl.c (duplicate_decls): Copy TREE_NOTHROW from newdecl to olddecl.
2004-09-28 Jason Merrill <jason@redhat.com> 2004-09-28 Jason Merrill <jason@redhat.com>
PR middle-end/17525 PR middle-end/17525
......
...@@ -1719,6 +1719,8 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1719,6 +1719,8 @@ duplicate_decls (tree newdecl, tree olddecl)
TREE_READONLY (olddecl) = 1; TREE_READONLY (olddecl) = 1;
if (TREE_THIS_VOLATILE (newdecl)) if (TREE_THIS_VOLATILE (newdecl))
TREE_THIS_VOLATILE (olddecl) = 1; TREE_THIS_VOLATILE (olddecl) = 1;
if (TREE_NOTHROW (newdecl))
TREE_NOTHROW (olddecl) = 1;
/* Merge the initialization information. */ /* Merge the initialization information. */
if (DECL_INITIAL (newdecl) == NULL_TREE if (DECL_INITIAL (newdecl) == NULL_TREE
...@@ -5237,7 +5239,7 @@ expand_static_init (tree decl, tree init) ...@@ -5237,7 +5239,7 @@ expand_static_init (tree decl, tree init)
if (DECL_FUNCTION_SCOPE_P (decl)) if (DECL_FUNCTION_SCOPE_P (decl))
{ {
/* Emit code to perform this initialization but once. */ /* Emit code to perform this initialization but once. */
tree if_stmt, inner_if_stmt = NULL_TREE; tree if_stmt = NULL_TREE, inner_if_stmt = NULL_TREE;
tree then_clause, inner_then_clause = NULL_TREE; tree then_clause, inner_then_clause = NULL_TREE;
tree guard, guard_addr, guard_addr_list; tree guard, guard_addr, guard_addr_list;
tree acquire_fn, release_fn, abort_fn; tree acquire_fn, release_fn, abort_fn;
...@@ -5277,10 +5279,16 @@ expand_static_init (tree decl, tree init) ...@@ -5277,10 +5279,16 @@ expand_static_init (tree decl, tree init)
/* Create the guard variable. */ /* Create the guard variable. */
guard = get_guard (decl); guard = get_guard (decl);
/* Begin the conditional initialization. */ /* This optimization isn't safe on targets which can reorder loads,
if_stmt = begin_if_stmt (); via speculative execution, caching behavior or whatever. In that
finish_if_stmt_cond (get_guard_cond (guard), if_stmt); case we force synchronization in __cxa_guard_acquire. */
then_clause = begin_compound_stmt (BCS_NO_SCOPE); if (!targetm.reorders_loads || !flag_threadsafe_statics)
{
/* Begin the conditional initialization. */
if_stmt = begin_if_stmt ();
finish_if_stmt_cond (get_guard_cond (guard), if_stmt);
then_clause = begin_compound_stmt (BCS_NO_SCOPE);
}
if (flag_threadsafe_statics) if (flag_threadsafe_statics)
{ {
...@@ -5343,9 +5351,12 @@ expand_static_init (tree decl, tree init) ...@@ -5343,9 +5351,12 @@ expand_static_init (tree decl, tree init)
finish_if_stmt (inner_if_stmt); finish_if_stmt (inner_if_stmt);
} }
finish_compound_stmt (then_clause); if (!targetm.reorders_loads || !flag_threadsafe_statics)
finish_then_clause (if_stmt); {
finish_if_stmt (if_stmt); finish_compound_stmt (then_clause);
finish_then_clause (if_stmt);
finish_if_stmt (if_stmt);
}
} }
else else
static_aggregates = tree_cons (init, decl, static_aggregates); static_aggregates = tree_cons (init, decl, static_aggregates);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment