This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Handle RESULT_DECL in set_uids_in_ptset (PR tree-optimization/32353)
On Sat, Jun 16, 2007 at 01:11:50PM -0400, Daniel Berlin wrote:
> On 6/16/07, Jakub Jelinek <jakub@redhat.com> wrote:
> >set_uids_in_ptset ignores RESULT_DECL and so points-to analysis doesn't
> >record that some pointer points to <result>. On 4.1/4.2 branches this
> >causes miscompilation for the testcase below on i?86-linux.
> >
> >Bootstrapped/regtested so far on 4.1 branch (7 linux arches) and on the
> >trunk (x86_64-linux only), ok for 4.3/4.2/4.1?
>
>
> I think we can just change it to DECL_P
> If you could try that, i would appreciate it.
> (Such a patch is preapproved, and if DECL_P doesn't work for some
> reason, this patch is also appoved!)
I'm not sure if doing this for any DECL_P is the right thing to do:
if (var_can_have_subvars (vi->decl)
&& get_subvars_for_var (vi->decl))
The former will return false for !DECL_P or MTAG_P, but the latter:
static inline subvar_t
get_subvars_for_var (tree var)
{
subvar_t subvars;
gcc_assert (SSA_VAR_P (var));
where SSA_VAR_P is {VAR,PARM,RESULT}_DECL or SSA_NAME thereof.
But SSA_NAME is not DECL_P so only those 3 tree codes are suitable.
The other branch of this if can handle any kind of DECL_P I guess,
so we could do:
else if ((TREE_CODE (vi->decl) == VAR_DECL
|| TREE_CODE (vi->decl) == PARM_DECL
|| TREE_CODE (vi->decl) == RESULT_DECL)
&& var_can_have_subvars (vi->decl)
&& get_subvars_for_var (vi->decl))
{
/* If VI->DECL is an aggregate for which we created
SFTs, add the SFT corresponding to VI->OFFSET. */
...
}
else if (DECL_P (vi->decl))
{
/* Otherwise, just add VI->DECL to the alias set.
Don't type prune artificial vars. */
...
}
Jakub