This is the mail archive of the
mailing list for the GCC project.
Re: [patch] tree-ssa-dom.c: Fix memory leak.
- From: Jeffrey A Law <law at redhat dot com>
- To: Kazu Hirata <kazu at cs dot umass dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 13 Dec 2004 10:35:02 -0700
- Subject: Re: [patch] tree-ssa-dom.c: Fix memory leak.
- Organization: Red Hat, Inc
- References: <firstname.lastname@example.org>
- Reply-to: law at redhat dot com
On Fri, 2004-12-10 at 19:31 -0500, Kazu Hirata wrote:
> Attached is a patch to fix memory leak in record_edge_info.
> In record_edge_info, we have a sequence of three "if" statements like
> if ((TREE_CODE (cond) == EQ_EXPR || TREE_CODE (cond) == NE_EXPR)
> && TREE_CODE (op0) == SSA_NAME
> && TREE_CODE (TREE_TYPE (op0)) == BOOLEAN_TYPE
> && is_gimple_min_invariant (op1))
> if (is_gimple_min_invariant (op0)
> && (TREE_CODE (op1) == SSA_NAME
> || is_gimple_min_invariant (op1)))
> if (TREE_CODE (op0) == SSA_NAME
> && (is_gimple_min_invariant (op1)
> || TREE_CODE (op1) == SSA_NAME))
> Blocks under each of these "if" statements allocate edge_info for two
> edges of a COND_EXPR. The problem is that when the first "if"
> condition holds, the third one necessarily holds, too.
Opps. That was a goof on my part when I recently reorganized this code.
> The patch fixes the problem by putting "else" in the second and third
> "if" statements so that at most one "if" will trigger.
That is the correct fix.
> With this patch, we no longer record expressions like LE_EXPR or
> GE_EXPR for boolean equality, but that should be OK as I don't think
> we use LE_EXPR or GE_EXPR on booleans.
I don't really follow what you're trying to say here. Can you elaborate
more? I don't think it matters, but I would like to understand what
you're trying to say.
> Tested on i686-pc-linux-gnu. OK to apply?
> Kazu Hirata
> 2004-12-10 Kazu Hirata <email@example.com>
> * tree-ssa-dom.c (record_edge_info): Fix memory leak.