Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gcc.dg/analyzer/data-model-14.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
line wrap: on
line source
/* FIXME: we shouldn't need this. */ /* { dg-additional-options "-fanalyzer-fine-grained" } */ #include <stdlib.h> void *global_ptr; void test_1 (int i) { global_ptr = malloc (1024); /* { dg-message "allocated here" } */ *(int *)&global_ptr = i; /* { dg-warning "leak of '<unknown>'" } */ // TODO: something better than "<unknown>" here ^^^ } void test_2 (int i) { void *p = malloc (1024); /* { dg-message "allocated here" "" { xfail *-*-* } } */ // TODO(xfail) global_ptr = p; *(int *)&p = i; p = global_ptr; free (p); free (global_ptr); /* { dg-warning "double-'free' of 'p'" } */ }