davidmalcolm / gcc-python-plugin

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

Unhandled Python exception in check_isinstance #78

Open davidmalcolm opened 7 years ago

davidmalcolm commented 7 years ago

Checking sanlock-python the following error is raised:

{{{ /home/simon/gcc-python-plugin/gcc-with-cpychecker -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I../src -I/usr/include/python2.7 -c sanlock.c -o build/temp.linux-x86_64-2.7/sanlock.o sanlock.c: In function ‘initsanlock’: sanlock.c:589:23: error: Unhandled Python exception raised calling 'execute' method Traceback (most recent call last): File "/home/simon/gcc-python-plugin/libcpychecker/init.py", line 79, in execute self._check_refcounts(fun) File "/home/simon/gcc-python-plugin/libcpychecker/init.py", line 85, in _check_refcounts dump_json=self.dump_json) File "/home/simon/gcc-python-plugin/libcpychecker/refcounts.py", line 4141, in check_refcounts maxtrans) File "/home/simon/gcc-python-plugin/libcpychecker/refcounts.py", line 3996, in impl_check_refcounts limits=limits) File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3056, in iter_traces depth + 1): File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 3020, in iter_traces transitions = curstate.get_transitions() File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 2073, in get_transitions return self._get_transitions_for_stmt(stmt) File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 2089, in _get_transitions_for_stmt return self._get_transitions_for_GimpleCall(stmt) File "/home/simon/gcc-python-plugin/libcpychecker/absinterp.py", line 2260, in _get_transitions_for_GimpleCall return meth(stmt, *args) File "/home/simon/gcc-python-plugin/libcpychecker/refcounts.py", line 2376, in impl_PyModule_AddObject s_success.cpython.steal_reference(v_value, stmt.loc) File "/home/simon/gcc-python-plugin/libcpychecker/refcounts.py", line 582, in steal_reference _steal_ref) File "/home/simon/gcc-python-plugin/libcpychecker/refcounts.py", line 392, in change_refcount check_isinstance(oldvalue, RefcountValue) File "/home/simon/gcc-python-plugin/gccutils.py", line 636, in check_isinstance raise TypeError('%s / %r is not an instance of %s' % (obj, obj, types)) TypeError: (Py_ssize_t)val [-0x7fffffffffffffff <= val <= 0x7fffffffffffffff] from sanlock.c:588 / WithinRange(gcctype='Py_ssize_t', loc=gcc.Location(file='sanlock.c', line=588), minvalue=-0x7fffffffffffffff, maxvalue=0x7fffffffffffffff) is not an instance of <class 'libcpychecker.refcounts.RefcountValue'> }}}

davidmalcolm commented 7 years ago

Imported from trac issue 38. Created by fsimonce on 2012-03-27T12:03:03, last modified: 2013-04-18T14:27:34

davidmalcolm commented 7 years ago

Trac comment by dmalcolm on 2012-03-27 12:08:57:

Can you post a link to the code being analyzed (with exact version)?

Also, what exact version of the plugin in git are you using? {{{ $ git rev-parse HEAD }}}

Thanks!

davidmalcolm commented 7 years ago

Trac comment by fsimonce on 2012-03-27 12:36:29:

The code is:

http://git.fedorahosted.org/git/?p=sanlock.git;a=blob;f=python/sanlock.c;h=9ece9da3f9fa955b02e78b53618bf6f6e8ddd43d;hb=HEAD

{{{ $ git rev-parse HEAD df15eee803ecc9de79ec14b261b6eade77358828 }}}

davidmalcolm commented 7 years ago

Trac comment by tromey on 2013-04-18 14:27:34:

This looks the same as issue #46, but that one has a minimal test case.