* [PATCH] Fix gimple_{,bind_}{,set_}block confusion with -finstrument-functions
@ 2008-10-03 19:52 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2008-10-03 19:52 UTC (permalink / raw)
To: gcc-patches
Hi!
After fixing declare_vars bug, I briefly looked at other spots which could
confuse gimple_{,bind_}block. gimple_block is something typically set
during gimple lowering and is the enclosing BLOCK which contains a
GIMPLE_BIND (NULL if bind is the outermost GIMPLE_BIND). gimple_bind_block
is GIMPLE_BIND's associated BLOCK. In this case bind is the former
outermost GIMPLE_BIND of a function, created by gimplify_body, so
gimple_block likely hasn't been set yet (is NULL) and gimple_bind_block
is supposed to be DECL_INITIAL (current_function_decl). For
-finstrument-functions we add some stuff around that GIMPLE_BIND, making
it no longer be the outermost GIMPLE_BIND, so the code IMHO wants to
move the DECL_INITIAL block from bind to new_bind, which is the new
outermost GIMPLE_BIND.
Bootstrapped/regtested on x86_64-linux, committed to trunk.
2008-10-03 Jakub Jelinek <jakub@redhat.com>
* gimplify.c (gimplify_function_tree): For -finstrument-functions
use gimple_bind_{,set_}block instead of gimple_{,set_}block.
* gimple.h (gimple_bind_set_block): Allow second argument to be NULL.
--- gcc/gimplify.c.jj 2008-10-03 17:04:56.000000000 +0200
+++ gcc/gimplify.c 2008-10-03 17:05:29.000000000 +0200
@@ -7366,10 +7366,10 @@ gimplify_function_tree (tree fndecl)
x = implicit_built_in_decls[BUILT_IN_PROFILE_FUNC_ENTER];
gimplify_seq_add_stmt (&body, gimple_build_call (x, 0));
gimplify_seq_add_stmt (&body, tf);
- new_bind = gimple_build_bind (NULL, body, gimple_block (bind));
+ new_bind = gimple_build_bind (NULL, body, gimple_bind_block (bind));
/* Clear the block for BIND, since it is no longer directly inside
the function, but within a try block. */
- gimple_set_block (bind, NULL);
+ gimple_bind_set_block (bind, NULL);
/* Replace the current function body with the body
wrapped in the try/finally TF. */
--- gcc/gimple.h.jj 2008-09-30 16:57:11.000000000 +0200
+++ gcc/gimple.h 2008-10-03 20:47:43.000000000 +0200
@@ -2602,7 +2602,7 @@ static inline void
gimple_bind_set_block (gimple gs, tree block)
{
GIMPLE_CHECK (gs, GIMPLE_BIND);
- gcc_assert (TREE_CODE (block) == BLOCK);
+ gcc_assert (block == NULL_TREE || TREE_CODE (block) == BLOCK);
gs->gimple_bind.block = block;
}
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-10-03 19:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-03 19:52 [PATCH] Fix gimple_{,bind_}{,set_}block confusion with -finstrument-functions Jakub Jelinek
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).