dereference of possibly-NULL ‘result [-Wanalyzer-possible-null-dereference]
25 result->i = i; /* { dg-warning "dereference of possibly-NULL 'result'" } */
~~~~~~~~~~^~~
make_boxed_int
make_boxed_int: events 1-2
22 make_boxed_int (int i)
^~~~~~~~~~~~~~
|
(1) entry to ‘make_boxed_int’
23 {
24 boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
(2) calling ‘wrapped_malloc’ from ‘make_boxed_int’
wrapped_malloc
wrapped_malloc: events 3-4
11 void *wrapped_malloc (size_t size)
^~~~~~~~~~~~~~
|
(3) entry to ‘wrapped_malloc’
12 {
13 return malloc (size);
~~~~~~~~~~~~~
|
(4) this call could return NULL
make_boxed_int: events 5-6
24 boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
(5) possible return of NULL to ‘make_boxed_int’ from ‘wrapped_malloc’
25 result->i = i; /* { dg-warning "dereference of possibly-NULL 'result'" } */
~~~~~~~~~~~~~
|
(6) ⚠️ ‘result’ could be NULL: unchecked value from (4)