public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/59287] New: points-to analysis confused by union accesses
@ 2013-11-25 15:17 rguenth at gcc dot gnu.org
  2013-11-26  9:04 ` [Bug tree-optimization/59287] " rguenth at gcc dot gnu.org
  2013-11-26  9:05 ` rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-25 15:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59287
           Summary: points-to analysis confused by union accesses
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org

static void
get_constraint_for_component_ref (tree t, vec<ce_s> *results,
                                  bool address_p, bool lhs_p)
{
...
  /* Handle type-punning through unions.  If we are extracting a pointer
     from a union via a possibly type-punning access that pointer
     points to anything, similar to a conversion of an integer to
     a pointer.  */
  if (!lhs_p)
    {
      tree u;
      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)
          {
            struct constraint_expr temp;

            temp.offset = 0;
            temp.var = anything_id;
            temp.type = ADDRESSOF;
            results->safe_push (temp);
            return;
          }
    }

has the adverse affect that if you have code like

  foo (TREE_CODE (t))

then it makes ANYTHING escape ... which is the worst thing that can happen.

The above shouldn't be necessary.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/59287] points-to analysis confused by union accesses
  2013-11-25 15:17 [Bug tree-optimization/59287] New: points-to analysis confused by union accesses rguenth at gcc dot gnu.org
@ 2013-11-26  9:04 ` rguenth at gcc dot gnu.org
  2013-11-26  9:05 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-26  9:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Tue Nov 26 09:04:44 2013
New Revision: 205380

URL: http://gcc.gnu.org/viewcvs?rev=205380&root=gcc&view=rev
Log:
2013-11-26  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/59287
    * tree-ssa-structalias.c (get_constraint_for_component_ref):
    Remove no longer necessary special-casing of union accesses.

    * gcc.dg/tree-ssa/alias-29.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/alias-29.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-structalias.c


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/59287] points-to analysis confused by union accesses
  2013-11-25 15:17 [Bug tree-optimization/59287] New: points-to analysis confused by union accesses rguenth at gcc dot gnu.org
  2013-11-26  9:04 ` [Bug tree-optimization/59287] " rguenth at gcc dot gnu.org
@ 2013-11-26  9:05 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-26  9:05 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|                            |4.9.0
         Resolution|---                         |FIXED

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-26  9:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-25 15:17 [Bug tree-optimization/59287] New: points-to analysis confused by union accesses rguenth at gcc dot gnu.org
2013-11-26  9:04 ` [Bug tree-optimization/59287] " rguenth at gcc dot gnu.org
2013-11-26  9:05 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).