This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problem with recompute_tree_invarant_for_addr_expr
Hello,
> On Mon, Jun 13, 2005 at 07:39:33PM +0200, Zdenek Dvorak wrote:
> > This has a small flaw -- in case NODE has variable size, it gets
> > allocated on stack dynamically, it may be allocated and deallocated
> > several times, and its address is no longer an invariant.
> >
> > So I tried to fix the code as follows:
> >
> > if (decl_function_context (node) == current_function_decl
> > && TREE_CONSTANT (DECL_SIZE (node))
> > ... /* set TREE_INVARIANT */
>
> Such nodes should never be seen having their address taken. They
> should be completely removed during gimplification. So I think we
> should stop here and figure out why you care about such nodes.
OK, I remembered. I put
if (is_gimple_min_invariant (t))
or
if (is_gimple_val (t))
{
shortcut;
}
type constructs on some places in gimplification. Which causes
problems, since is_gimple_min_invariant only checks the TREE_INVARIANT
flag for ADDR_EXPRs, and ADDR_EXPRs of variable sized decls then leak through.
The change to recompute_tree_invarant_for_addr_expr was intended to
prevent this.
Zdenek