[Bug middle-end/40135] New: using alias-set zero for union accesses necessary because of RTL alias oracle

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed May 13 20:31:00 GMT 2009


The RTL alias oracle does defer to TBAA even for the case of disambiguating
two accesses based on decls.  This makes

  /* Permit type-punning when accessing a union, provided the access
     is directly through the union.  For example, this code does not
     permit taking the address of a union member and then storing
     through it.  Even the type-punning allowed here is a GCC
     extension, albeit a common and useful one; the C standard says
     that such accesses have implementation-defined behavior.  */
  for (u = t;
       TREE_CODE (u) == COMPONENT_REF || TREE_CODE (u) == ARRAY_REF;
       u = TREE_OPERAND (u, 0))
    if (TREE_CODE (u) == COMPONENT_REF
        && TREE_CODE (TREE_TYPE (TREE_OPERAND (u, 0))) == UNION_TYPE)
      return 0;

in c-common.c necessary which needlessly pessimizes TBAA in the face
of union accesses.


-- 
           Summary: using alias-set zero for union accesses necessary
                    because of RTL alias oracle
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, alias
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40135



More information about the Gcc-bugs mailing list