Bug path

test_1
‘test_1’: events 1-2
10int *test_1 (int i)
^~~~~~
|
(1) entry to ‘test_1’
11{
12 int *ptr = (int *)calls_malloc ();
~~~~~~~~~~~~~~~
|
(2) calling ‘calls_malloc’ from ‘test_1’
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_1’: events 5-6
12 int *ptr = (int *)calls_malloc ();
^~~~~~~~~~~~~~~
|
(5) possible return of NULL to ‘test_1’ from ‘calls_malloc’
13 *ptr = i; /* { dg-warning "dereference of possibly-NULL 'ptr'" } */
~~~~~~~~
|
(6) ‘ptr’ could be NULL: unchecked value from (4)