aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/malloc-dce.c
blob: 1b4b8788b86b831148de0c2396822c4f8392e996 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* { dg-additional-options "-O2" } */

#include <stdlib.h>

void test(void)
{
    void *ptr = malloc(512);
    free(ptr);
    free(ptr); /* { dg-warning "double-'free'" "" { xfail *-*-* } } */
}
/* With optimization, the whole of test() goes away in the "cddce" pass
   before the analysis pass sees it, and hence we get no error message.  */