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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org,
                   |                            |rth at gcc dot gnu.org

--- Comment #5 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-01-11 
15:07:15 UTC ---
The main problem here is that we are using ptr_deref_may_alias_global_p() to
determine if a dereferenced address escapes whereas we were previously using
is_call_clobbered() which understood VAR_DECLs, not just SSA_NAMEs.

In requires_barrier() we call ptr_deref_may_alias_global_p() to determine if
the address of `lala' below will escape:

struct large { int x[100]; };
extern struct large foobie (void) __attribute__((transaction_safe));
int asdf;

int f()
{ 
  struct large lala;
  struct large lacopy = foobie();
  __transaction_atomic {
    lala = lacopy;   <-- STORE SHOULD BE TRXN/THREAD LOCAL
  }
  return lala.x[asdf];
}

Before the fix to PR tree-optimization/43572, we used is_call_clobbered() which
returned false for `lala', and everything worked fine.  However, we are now
using ptr_deref_may_alias_global_p() which only understands SSA_NAMEs, and
`lala' is a VAR_DECL.

Mr. Guenther (or Mr. Henderson), what is the recommended course of action here?

As an aside (for the PR record), requires_barrier() also needs to handle
ARRAY_REF.

Reply via email to