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] Remove special-casing of PTR_IS_REF_ALL pointers from alias analysis


> Huh?  That would be weird semantics.  Suppose
>
>   int x;
>   int *{ref-all} p;
> ...
>   sth takes &x
> ...
>   *p = 0;
>   x = 1;
>
> &x address doesn't need to escape to cause *p conflict with the store to x.

Sure, it's int* and int.  The idea was to say that, if you can prove that 
"sth" doesn't "escape" to a ref-all pointer, there is no conflict:

  float x;
  int *{ref-all} p;
  float *q;
...
  q = &x;
  q dead
...
  *p = 0;
  x = 1.0;

but for

  float x;
  int *{ref-all} p;
  float *q;
...
  q = &x;
  p = (int *)q;
...
  *p = 0;
  x = 1.0;

there is one.

> Can you give a formal specification of TYPE_REF_CAN_ALIAS_ALL please?
> The way it is "implemented" in alias.c:get_alias_set it is just a
> pointer to memory with alias set zero.

I'm not very good at formal specifications when it comes to aliasing. :-)

I guess the tree.h definition is the definitive reference:

/* Nonzero in a pointer or reference type means the data pointed to
   by this type can alias anything.  */
#define TYPE_REF_CAN_ALIAS_ALL(NODE) \
  (PTR_OR_REF_CHECK (NODE)->base.static_flag)

My interpretation is that the "can" is a possibility, i.e. it's legal in a 
program to have...  If you can prove that it's not the case, that's better.

-- 
Eric Botcazou


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