> HMm, i'd just record it for all of them, since the [fields] are accessible
> through a pointer to the structure.

They are indeed accessible this way...

> Just because you can't directly take the address of a bitfield doesn't
> mean you can't access one through a pointer, which is the entire
> purpose of knowing alias sets (knowing what a pointer dereference
> could affect).

...but DECL_NONADDRESSABLE_P precisely means that the alias set used for 
accessing these fields at the RTL level is that of the containing structure:


/* Return true if all nested component references handled by
   get_inner_reference in T are such that we should use the alias set
   provided by the object at the heart of T.

   This is true for non-addressable components (which don't have their
   own alias set), as well as components of objects in alias set zero.
   This later point is a special case wherein we wish to override the
   alias set used by the component, but we don't have per-FIELD_DECL
   assignable alias sets.  */

bool
component_uses_parent_alias_set (tree t)
{
  while (1)
    {
      /* If we're at the end, it vacuously uses its own alias set.  */
      if (!handled_component_p (t))
        return false;

      switch (TREE_CODE (t))
        {
        case COMPONENT_REF:
          if (DECL_NONADDRESSABLE_P (TREE_OPERAND (t, 1)))
            return true;
          break;


so the code in record_component_aliases is consistent with that.


Adam has simply run with C into another form of the same discrepancy we have 
run into when we tried to enable struct aliasing with Ada, see PR 25737.

-- 
Eric Botcazou

Reply via email to