IRA: Ignore debug insns for uses in split_live_ranges_for_shrink_wrap. [PR116179]
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / refcounting-1.c
blob4eb3a3e6ff20b0df8d6c23bc5912f19d32b6800b
1 #include "analyzer-decls.h"
3 typedef struct obj {
4 int ob_refcnt;
5 } PyObject;
7 extern void Py_Dealloc (PyObject *op);
9 #define Py_INCREF(op) \
10 do { \
11 ((PyObject*)(op))->ob_refcnt++; \
12 } while (0)
14 #define Py_DECREF(op) \
15 do { \
16 if (--((PyObject*)(op))->ob_refcnt == 0) \
17 { \
18 /*Py_Dealloc((PyObject *)(op));*/ \
19 } \
20 } while (0)
22 void test_1 (PyObject *obj)
24 int orig_refcnt = obj->ob_refcnt;
25 Py_INCREF (obj);
26 Py_INCREF (obj);
27 Py_DECREF (obj);
28 Py_INCREF (obj);
29 __analyzer_eval (obj->ob_refcnt == orig_refcnt + 2); /* { dg-warning "TRUE" } */
31 /* TODO: uncomment the Py_Dealloc, which leads to two paths. */