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

            Bug ID: 118498
           Summary: -Wmismatched-dealloc false negative
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alx at kernel dot org
  Target Milestone: ---

Hi,

I don't find this having been reported; it seems quite trivial.

alx@devuan:~/tmp/gcc$ cat malloc2.c 
#include <stdio.h>
#include <stdlib.h>

[[gnu::malloc(free)]]
char *f(void);

int
main(void)
{
        char *s;

        s = f();
        if (s == NULL)
                return 1;

        puts(s);
}
alx@devuan:~/tmp/gcc$ gcc-15 -Wall -Wextra -Wmismatched-dealloc -S -fanalyzer
-O3 malloc2.c
alx@devuan:~/tmp/gcc$ gcc-15 -Wall -Wextra -Wmismatched-dealloc -S -fanalyzer
malloc2.c



alx@devuan:~/tmp/gcc$ gcc-15 --version
gcc-15 (Debian 15-20250114-1) 15.0.1 20250114 (experimental) [master
r15-6887-g20b8500cfa5]
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I can also reproduce it with gcc-14.

Reply via email to