This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR33870, alias bug with SFTs and pointers


While trying to grok the problem and possible solutions I went over
set_uids_in_ptset where we do:

static void
set_uids_in_ptset (tree ptr, bitmap into, bitmap from, bool is_derefed,
                   bool no_tbaa_pruning)
{
...
  alias_set_type ptr_alias_set = get_alias_set (TREE_TYPE (ptr));

  EXECUTE_IF_SET_IN_BITMAP (from, 0, i, bi)
    {
...
                  if (no_tbaa_pruning
                      || (!is_derefed && !vi->directly_dereferenced)
                      || alias_sets_conflict_p (ptr_alias_set, var_alias_set))

that is, we ask for alias set conflicts of the pointer type with a
pointed-to variable (or subvariable).  This looks bogus.  Ideally
we want to ask

  ptr_alias_set = get_alias_set (build1 (INDIRECT_REF, TREE_TYPE 
(TREE_TYPE (ptr)), ptr));

to also catch things like DECL_POINTER_ALIAS_SET, but probably just
asking for get_alias_set (TREE_TYPE (TREE_TYPE (ptr))) should be
good enough for a start.

Also we special case (!is_derefed && !vi->directly_dereferenced) which
looks backward?  Don't we want to add the alias if either is_derefed
is set or vi->directly_dereferenced?  That is,

		      || is_derefed || vi->directly_dereferenced

?

Thanks,
Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]