davidmalcolm / gcc-python-plugin

GCC plugin that embeds CPython inside the compiler
GNU General Public License v3.0
196 stars 58 forks source link

Infinite recursion #163

Open dvarrazzo opened 5 years ago

dvarrazzo commented 5 years ago

Analysing the function:

RAISES_NEG static int
_psyco_curs_prefetch(cursorObject *self)
{
    int i = 0;

    if (self->pgres == NULL) {
        Dprintf("_psyco_curs_prefetch: trying to fetch data");
        do {
            i = pq_fetch(self, 0);
            Dprintf("_psycopg_curs_prefetch: result = %d", i);
        } while(i == 1);
    }

    Dprintf("_psyco_curs_prefetch: result = %d", i);
    return i;
}

the following traceback is returned:

psycopg/cursor_type.c: In function ‘_psyco_curs_prefetch’:
psycopg/cursor_type.c:665:12: error: Unhandled Python exception raised calling 'execute' method
     return i;
            ^
Traceback (most recent call last):
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/__init__.py", line 95, in execute
    self._check_refcounts(fun)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/__init__.py", line 101, in _check_refcounts
    dump_json=self.dump_json)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/refcounts.py", line 4414, in check_refcounts
    maxtrans)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/refcounts.py", line 4267, in impl_check_refcounts
    limits=limits)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 3047, in iter_traces
    depth + 1):
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 3047, in iter_traces
    depth + 1):
[...]
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 3047, in iter_traces
    depth + 1):
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 3011, in iter_traces
    transitions = curstate.get_transitions()
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 2049, in get_transitions
    return self._get_transitions_for_stmt(stmt)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 2076, in _get_transitions_for_stmt
    return self._get_transitions_for_GimpleAssign(stmt)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 2605, in _get_transitions_for_GimpleAssign
    None)]
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 1925, in mktrans_assignment
    new = self.use_next_stmt_node()
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 1949, in use_next_stmt_node
    return self.update_stmt_node(new_stmt_node)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 1931, in update_stmt_node
    new = self.copy()
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 1416, in copy
    self.region_for_var.copy(),
  File "/usr/lib/python2.7/collections.py", line 206, in copy
    return self.__class__(self)
  File "/usr/lib/python2.7/collections.py", line 69, in __init__
    self.__update(*args, **kwds)
  File "/usr/lib/python2.7/_abcoll.py", line 564, in update
    if isinstance(other, Mapping):
  File "/usr/lib/python2.7/abc.py", line 132, in __instancecheck__
    if subclass is not None and subclass in cls._abc_cache:
  File "/usr/lib/python2.7/_weakrefset.py", line 75, in __contains__
    return wr in self.data
RuntimeError: maximum recursion depth exceeded in cmp