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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2017-11-17 00:00:00         |2025-4-8
           Assignee|nathan at gcc dot gnu.org          |pinskia at gcc dot 
gnu.org

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Since I am working in this area I am going to take over as there has been no
movement on this since 2017 really.

My idea is to do the following:

if bb of the malloc and the "memset" are the same allow it.

check the pred of the "memset" bb to see if the malloc bb.
  if not, reject
  otherwise check that the last statement of the malloc bb is a condtional and
that is checking on the address is non null


This will allow for things like:
```
void *m (int s, bool c, bool *a)
{
  void *r = __builtin_malloc (s);
  *a = 1;
 if (r)
  {
    __builtin_memset (r, 0, s);
  }
  return r;
}
```

Reply via email to