Bug path

test_2
‘test_2’: events 1-2
19int *test_2 (int i)
^~~~~~
|
(1) entry to ‘test_2’
20{
21 int *ptr = (int *)calls_malloc ();
~~~~~~~~~~~~~~~
|
(2) calling ‘calls_malloc’ from ‘test_2’
calls_malloc
‘calls_malloc’: events 3-4
4calls_malloc (void)
^~~~~~~~~~~~
|
(3) entry to ‘calls_malloc’
5{
6 void *result = malloc (1024);
~~~~~~~~~~~~~
|
(4) this call could return NULL
‘test_2’: events 5-6
21 int *ptr = (int *)calls_malloc ();
^~~~~~~~~~~~~~~
|
(5) possible return of NULL to ‘test_2’ from ‘calls_malloc’
22 *ptr = i; /* { dg-warning "dereference of possibly-NULL 'ptr'" } */
~~~~~~~~
|
(6) ‘ptr’ could be NULL: unchecked value from (4)