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-9
57base_obj *alloc_obj (type_obj *ob_type, size_t sz)
^~~~~~~~~
|
(5) entry to ‘alloc_obj’
58{
59 base_obj *obj = (base_obj *)malloc (sz);
~~~~~~~~~~~
|
(6) allocated here
60 if (!obj)
~
|
(7) assuming ‘obj’ is non-NULL
(8) following ‘false’ branch (when ‘obj’ is non-NULL)...
61 return NULL;
62 obj->ob_type = ob_type;
~~~~~~~~~~~~~~~~~~~~~~
|
(9) ...to here
‘new_string_obj’: event 10
73 = (string_obj *)alloc_obj (&str_type, sizeof (string_obj) + len + 1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
(10) returning to ‘new_string_obj’ from ‘alloc_obj’
‘test_1’: events 11-12
99 base_obj *obj = new_string_obj (str);
^~~~~~~~~~~~~~~~~~~~
|
(11) returning to ‘test_1’ from ‘new_string_obj’
100 unref (obj);
~~~~~~~~~~~
|
(12) calling ‘unref’ from ‘test_1’
‘unref’: events 13-15
87void unref (base_obj *obj)
^~~~~
|
(13) entry to ‘unref’
88{
89 if (--obj->ob_refcnt == 0) /* { dg-bogus "dereference of uninitialized pointer 'obj'" } */
~
|
(14) following ‘false’ branch...
[...]
95}
~
|
(15) ...to here
‘test_1’: events 16-17
100 unref (obj);
^~~~~~~~~~~
|
(16) returning to ‘test_1’ from ‘unref’
101} /* { dg-bogus "leak" "" { xfail *-*-* } } */
~
|
(17) ‘obj’ leaks here; was allocated at (6)