Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/ubsan-pr118300.c

raw
1 /* { dg-do compile } */
2 /* { dg-additional-options "-fsanitize=undefined" } */
3
4 #include <stdlib.h>
5
6 void test ()
7 {
8 int*** ptr = (int ***)malloc(sizeof(int**));
9 *ptr = (int **)malloc(sizeof(int*)); /* { dg-warning "dereference of possibly-NULL" } */
10 **ptr = (int *)malloc(sizeof(int)); /* { dg-warning "dereference of possibly-NULL" } */
11
12 free(**ptr);
13 free(*ptr);
14 free(ptr);
15 }