https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116570

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xry111 at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
The attribute is not enough to prove the store is dead.  For example, in
another TU:

static void *last_alloc_blk;

void *malloc_test(size_t size, size_t align)
{
  last_alloc_blk = malloc(size + align);
  void *p = (void *)(((uintptr_t) last_alloc_blk + align - 1) & ~(align - 1));
  record_blk_for_ptr(p, last_alloc_blk);
}

void *free_test(void *p) __attribute__((access(none, 1)));
{
  // uses the content of the block allocated last time
  // note that we are NOT accessing anything via p
  // so we are not violating the access attribute
  do_something_with(last_alloc_blk);

  free(get_blk_and_remove_the_record(p));
}

Reply via email to