Bug path

‘test_1’: events 1-2
97void test_1 (const char *str)
^~~~~~
|
(1) entry to ‘test_1’
98{
99 base_obj *obj = new_string_obj (str);
~~~~~~~~~~~~~~~~~~~~
|
(2) calling ‘new_string_obj’ from ‘test_1’
‘new_string_obj’: events 3-4
67base_obj *new_string_obj (const char *str)
^~~~~~~~~~~~~~
|
(3) entry to ‘new_string_obj’
[...]
73 = (string_obj *)alloc_obj (&str_type, sizeof (string_obj) + len + 1);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
(4) calling ‘alloc_obj’ from ‘new_string_obj’
‘alloc_obj’: events 5-6
57base_obj *alloc_obj (type_obj *ob_type, size_t sz)
^~~~~~~~~
|
(5) entry to ‘alloc_obj’
[...]
60 if (!obj)
~
|
(6) following ‘true’ branch (when ‘obj’ is NULL)...
‘alloc_obj’: event 7
61 return NULL;
^~~~
|
(7) ...to here
‘alloc_obj’: event 8
61 return NULL;
^~~~
|
(8) ‘0’ is NULL
‘new_string_obj’: events 9-13
73 = (string_obj *)alloc_obj (&str_type, sizeof (string_obj) + len + 1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
(9) returning to ‘new_string_obj’ from ‘alloc_obj’
[...]
84 return (base_obj *)str_obj;
~~~~~~~~~~~~~~~~~~~
|
(10) ‘str_obj’ is NULL
(11) ‘str_obj’ is NULL
(12) ‘str_obj’ is NULL
(13) ‘str_obj’ is NULL
‘test_1’: events 14-15
99 base_obj *obj = new_string_obj (str);
^~~~~~~~~~~~~~~~~~~~
|
(14) return of NULL to ‘test_1’ from ‘new_string_obj’
100 unref (obj);
~~~~~~~~~~~
|
(15) calling ‘unref’ from ‘test_1’
‘unref’: events 16-17
87void unref (base_obj *obj)
^~~~~
|
(16) entry to ‘unref’
88{
89 if (--obj->ob_refcnt == 0) /* { dg-bogus "dereference of uninitialized pointer 'obj'" } */
~~~~~~~~~~~~~~
|
(17) dereference of NULL ‘obj’