[Bug tree-optimization/87313] attribute malloc not used for alias analysis when it could be

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Sep 17 14:36:00 GMT 2018


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
   Last reconfirmed|                            |2018-09-17
         Resolution|INVALID                     |---
     Ever confirmed|0                           |1

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
My reading of the attribute malloc documentation:

  the pointer P returned by the function cannot alias any other pointer valid
when the function returns, and moreover no pointers to valid objects occur in
any storage addressed by P.

is that in

  int **q = g (sizeof (int*));
  *q = 0;   // *q cannot be equal to *p prior to the assignment

the assignment to *q cannot clobber any object because *q doesn't store a
pointer to any storage.


More information about the Gcc-bugs mailing list