[Bug c/105346] -Wno-free-nonheap-object false positive (on Bison-generated grammar code)

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Apr 22 12:21:21 GMT 2022


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-04-22

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
It doesn't diagnose a simple testcase like

#include <stdlib.h>
void bar (void *);
void foo (int n)
{
  int a[100];
  int *p = a;
  if (n > 100)
    p = malloc (n*sizeof(int));
  bar (p);
  if (p != a)
    free (p);
}

so maybe you can provide preprocessed source of the TU that diagnoses such a
case in a more complicated setting?


More information about the Gcc-bugs mailing list