Git Product home page Git Product logo

gcc-python-plugin's Introduction

gcc-python

This is a plugin for GCC, which links against libpython, and (I hope) allows you to invoke arbitrary Python scripts from inside the compiler. The aim is to allow you to write GCC plugins in Python.

The plugin is Free Software, licensed under the GPLv3 (or later).

It's still at the "experimental proof-of-concept stage"; expect crashes and tracebacks (I'm new to insides of GCC, and I may have misunderstood things).

It's already possible to use this to add additional compiler errors/warnings, e.g. domain-specific checks, or static analysis. One of my goals for this is to "teach" GCC about the common mistakes people make when writing extensions for CPython, but it could be used e.g. to teach GCC about GTK's reference-counting semantics, or about locking in the Linux kernel, or about signal-safety in APIs.

Other ideas include visualizations of code structure. Given a gcc.CFG instance, gccutils.render_to_dot(cfg) and gccutils.invoke_dot(cfg) will use graphviz and eog to plot a handy visualization of a control flow graph, showing the source code interleaved with GCC's GIMPLE internal representation.

The documentation can be seen at:

http://gcc-python-plugin.readthedocs.io/en/latest/index.html

Requirements

  • GCC: 4.6 or later (it uses APIs that weren't exposed to plugins in 4.5)
    • tested with 4.8, 4.9, 5, 6, 7, and 8.
  • GCC plugin development package: usually available in distribution packages such as gcc-N-plugin-dev or gcc-plugin-devel.
  • Python: requires 2.7 or 3.2 or later
  • "six": The libcpychecker code uses the "six" Python compatibility library to smooth over Python 2 vs Python 3 differences, both at build-time and run-time

Usage

I use:

make

to build the plugin and run the tests

You can also use:

make demo

to demonstrate the new compiler errors.

Development has been on x86_64 and I don't know to what extent it will be compatible with other architectures.

There isn't an installer yet. In theory you should be able to add these arguments to the gcc invocation:

gcc -fplugin=python.so -fplugin-arg-python-script=PATH_TO_SCRIPT.py OTHER_ARGS

and have it run your script as the plugin starts up.

The plugin automatically adds the absolute path to its own directory to the end of its sys.path, so that it can find support modules, such as gccutils.py and libcpychecker.

The exact API is still in flux; you can currently connect to events by registering callbacks e.g. to be called for each function in the source at different passes.

It exposes GCC's various types as Python objects, within a "gcc" module. You can see the API by running:

import gcc
help(gcc)

from within a script.

Overview of the code

This is currently three projects in one:

gcc-python-*: the plugin for GCC. The entrypoint (init_plugin) is in gcc-python.c.

libcpychecker and cpychecker.py: a Python library (and a driver script), written for the plugin, in which I'm building new compiler warnings to help people find bugs in CPython extension code.

cpybuilder: a handy module for programatically generating C source code for CPython extensions. I use this both to generate parts of the GCC plugin, and also in the selftests for the cpychecker script. (I initially attempted to use Cython for the former, but wrapping the "tree" type hierarchy required more programatic control)

Coding style: Python and GCC each have their own coding style guide for C. I've chosen to follow Python's (PEP-7), as I prefer it (although my code is admittedly a mess in places).

You'll find API documentation within the "docs" directory, written in the reStructuredText format (as is this file, in fact). If you have Sphinx installed, you can regenerate these docs using:

make html

within the docs directory. Sphinx is the python-sphinx package on a Fedora/RHEL box.

More detailed documentation can be seen within docs/getting-involved.rst.

Enjoy! David Malcolm <[email protected]>

gcc-python-plugin's People

Contributors

bloff avatar bukzor avatar davidmalcolm avatar dmaggot avatar dvarrazzo avatar eevee avatar eqvinox avatar evdenis avatar fishilico avatar jackrosenthal avatar jwakely avatar philberty avatar ratmice avatar stefanor avatar tromey avatar vries avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gcc-python-plugin's Issues

ugly error message

When compiling gdb with gcc-with-cpychecker, I see some errors like this:

../../src/gdb/tui/tui-stack.c:421:32: warning: passing uninitialized data as argument 4 to function: gcc.VarDecl('a') at ../../src/gdb/tui/tui-stack.c:421 [enabled by default]

I don't think I should ever see 'gcc.VarDecl' in an error message; instead, I think it should refer to the variable name used in the source.

Program transformation

I can't glean this from the documentation

Is this plugin "read only"? Can we actually transform source code with it? I can't find any examples in the documentation.

API inconsistency: .loc -vs- .location

I noticed recently that gcc.Gimple has a 'loc'
attribute, but gcc.Declaration has a 'location'
attribute.
I think it would be better to use a single name
everywhere.

Failed to get propper argument_types property on function declaration

The following declaration appears in the preprocessed stdio.h from gcc's standard C library:
extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...);

I made a python plugin for gcc with callbacks on PLUGIN_FINISH_DECL, hoping to translate such declarations into equivalent declarations in a different programming language.

However:
When parsing this declaration, I get a gcc.FunctionDecl object, and in this object there is a type attribute of type gcc.FunctionType, and the problem is: the argument_types attribute of this gcc.FunctionType is a list of length 1!

I expected length 3, with the last type being a va_args kind of thing...

I will try to fix it myself, but meanwhile I leave here an issue report.

html v2

This is a big-ticket to get the revamped html into a usable-by-default state.

This is blocked by four tasks:

  • #8 remove lxml dependency
  • #9 generate by default
  • #10 inline html depdendencies
  • #11 optimize size a little

@davidmalcolm Could you review this plan and let me know if it needs to be altered and/or what order you'd like to see these four patches? I'll start work after I hear the go-ahead.

expose DECL_ASSEMBLER_NAME

For my project it would be handy to have access to
DECL_ASSEMBLER_NAME. This is available on most (but not all)
decl nodes, see tree.h.

gcc.Block.vars no longer contains unused globals in gcc 4.7

Am testing with gcc 4.7; specifically with Fedora's:
gcc-4.7.0-0.2.fc17.x86_64

cpychecker fails with numerous errors where it tries to look up global exception objects, where
{{{
exc_decl = gccutils.get_global_vardecl_by_name(exc_name)
}}}
is returning None

For example, it doesn't find the:
{{{
PyAPI_DATA(PyObject *) PyExc_MemoryError;
}}}
as a gcc.VarDecl within the block's "vars" attribute.

Upon debugging, this appears to be due to this changed line in gcc/c-decl.c:
in 4.7.0:
{{{
else if (VAR_OR_FUNCTION_DECL_P (p) && scope != file_scope)
}}}
in 4.6.1:
{{{
else if (VAR_OR_FUNCTION_DECL_P (p))
}}}

which seems to have been GCC's PR debug/51410:

Python exception from negative shift

cpychecker fails with the appended Python stack trace when compiling gdb.

I think that the user should never see a Python exception. However, in this case I also think that the underlying error is erroneous.
{{{
../../archer/gdb/arm-tdep.c: In function ‘cleanup_block_load_all’:
../../archer/gdb/arm-tdep.c:6586:22: error: Unhandled Python exception raised calling 'execute' method
Traceback (most recent call last):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 64, in execute
self._check_refcounts(fun)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 68, in _check_refcounts
self.show_possible_null_derefs)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 2838, in check_refcounts
limits=limits)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2680, in iter_traces
transitions = curstate.get_transitions()
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1828, in get_transitions
return self._get_transitions_for_stmt(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1855, in _get_transitions_for_stmt
return self._get_transitions_for_GimpleAssign(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2308, in _get_transitions_for_GimpleAssign
value = self.eval_rhs(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2251, in eval_rhs
c = a.eval_binop(stmt.exprcode, b, stmt.lhs.type, stmt.loc)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 453, in eval_binop
newvalue = eval_binop(exprcode, self.value, rhs.value)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 365, in eval_binop
result = inner()
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 354, in inner
return a << b
ValueError: negative shift count
}}}

seemingly invalid "too complicated" error

When compiling gdb with gcc-with-cpychecker, I see:

../../src/gdb/python/python.c: In function ‘_initialize_python’:
../../src/gdb/python/python.c:1137:1: note: this function is too complicated for the reference-count checker to fully analyze: not all paths were analyzed

In this instance, I think the error is quite strange; the function in question is completely linear (no "if"s or loops); there should be just a single path through it.

I can post the function body or the gcc -E output if that would help.

provide a way to indicate that refcounting rules should not apply

In gdb, most Python wrapper classes maintain a kind of weak reference to the underlying gdb object. This is done because the object lifetimes are different, and some of the gdb objects are quite large; so keeping them live due to a reference from Python is not a good solution.

These "weak references" are implemented by things like linked lists in gdb, pointing to the Python wrapper objects. When the gdb object dies, we traverse the list and set an internal field (the back-pointer to the gdb object) to NULL.

We also have code in the Python object's destructor to remove the objects from the list.

In this situation the code to add the object to the linked list can cause false errors. E.g.:

../../archer/gdb/python/py-block.c: In function ‘set_block’:
../../archer/gdb/python/py-block.c:265:1: error: ob_refcnt of '*obj' is 1 too low [-Werror]
../../archer/gdb/python/py-block.c:265:1: note: was expecting final ob_refcnt to be N + 1 (for some unknown N)

It would be nice to have an attribute we could use to tell the checker that the usual rules don't apply somehow.

RuntimeError: attribute 'fullname' is only available when compiling C++ code

I got this error when trying to use gccutils.pformat when compiling C code:

{{{
File "/home/tromey/Space/Trunk/gcc-python-plugin/cvtlisp.py", line 204, in map_tree
print gccutils.pformat(tree)
File "/home/tromey/Space/Trunk/gcc-python-plugin/gccutils.py", line 123, in pformat
return pp.pformat(obj)
File "/home/tromey/Space/Trunk/gcc-python-plugin/gccutils.py", line 176, in pformat
return self._recursive_format_obj(obj, set(), 0)
File "/home/tromey/Space/Trunk/gcc-python-plugin/gccutils.py", line 208, in _recursive_format_obj
visited, depth + 1)
File "/home/tromey/Space/Trunk/gcc-python-plugin/gccutils.py", line 199, in _recursive_format_obj
for name, value in self.iter_tree_attrs(obj):
File "/home/tromey/Space/Trunk/gcc-python-plugin/gccutils.py", line 143, in iter_tree_attrs
value = getattr(obj, name)
RuntimeError: attribute 'fullname' is only available when compiling C++ code
}}}

NotImplementedError from checker in impl_PyTuple_Size (NotImplementedError: eval_rvalue: None None)

A different NotImplementedError when building gdb:
{{{
../../archer/gdb/python/py-value.c: In function ‘valpy_new’:
../../archer/gdb/python/py-value.c:130:20: error: Unhandled Python exception raised calling 'execute' method
Traceback (most recent call last):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 64, in execute
self._check_refcounts(fun)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 68, in _check_refcounts
self.show_possible_null_derefs)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 2838, in check_refcounts
limits=limits)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2680, in iter_traces
transitions = curstate.get_transitions()
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1828, in get_transitions
return self._get_transitions_for_stmt(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1844, in _get_transitions_for_stmt
return self._get_transitions_for_GimpleCall(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1995, in _get_transitions_for_GimpleCall
return meth(stmt, *args)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 2512, in impl_PyTuple_Size
fnmeta.desc_when_call_returns_value('ob_size'))
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1733, in mktrans_assignment
new.assign(lhs, rhs, self.loc.get_gcc_loc())
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1405, in assign
value = self.eval_rvalue(rhs, loc)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1395, in eval_rvalue
raise NotImplementedError('eval_rvalue: %r %s' % (expr, expr))
NotImplementedError: eval_rvalue: None None
}}}

test ticket

(Am testing email notifications from the Trac instance)

False positive with PyTuple_SetItem() where index can't be out of range

See e.g.:
http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-03-05/pygoocanvas-0.14.1-6.fc17/pygoocanvas-0.14.1/.libs/goocanvas.c._wrap_goo_canvas_item_model_get_child_properties-refcount-errors.html#report-0

The checker considered that the possibility of PyTuple_SetItem() failing due to index out of range (and thus not stealing the reference, leading to a leak), but it's provable that the index is within range (and is of the correct type), thus the call can't fail.

Python exception from divide by zero

I saw this Python exception due to a divide-by-zero.
I think the user should never see a Python trace,
so the checker should issue an error or something here
instead.

The code is:
{{{
reloc_count = relplt->size / elf_section_data (relplt)->this_hdr.sh_entsize;
}}}
This actually can never be 0.
{{{
../../archer/gdb/elfread.c: In function ‘elf_rel_plt_read’:
../../archer/gdb/elfread.c:634:15: error: Unhandled Python exception raised calling 'execute' method
Traceback (most recent call last):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 64, in execute
self._check_refcounts(fun)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 68, in _check_refcounts
self.show_possible_null_derefs)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 2838, in check_refcounts
limits=limits)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2680, in iter_traces
transitions = curstate.get_transitions()
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1828, in get_transitions
return self._get_transitions_for_stmt(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1855, in _get_transitions_for_stmt
return self._get_transitions_for_GimpleAssign(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2308, in _get_transitions_for_GimpleAssign
value = self.eval_rhs(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2251, in eval_rhs
c = a.eval_binop(stmt.exprcode, b, stmt.lhs.type, stmt.loc)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 587, in eval_binop
values = (eval_binop(exprcode, self.minvalue, rhs.minvalue),
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 365, in eval_binop
result = inner()
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 340, in inner
return a // b
ZeroDivisionError: integer division or modulo by zero
}}}

undocumented fields of IntegerType

At least the min_value and max_value fields of
IntegerType are undocumented. I think there are more
fields that aren't documented but I didn't do an
exhaustive check.

NotImplementedError from checker (Don't know how to cope with exprcode: <type 'gcc.RealCst'>)

I saw this NotImplementedError when running the checker on gdb.
{{{
../../archer/gdb/python/py-value.c: In function ‘valpy_float’:
../../archer/gdb/python/py-value.c:1098:10: error: Unhandled Python exception raised calling 'execute' method
Traceback (most recent call last):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 64, in execute
self._check_refcounts(fun)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 68, in _check_refcounts
self.show_possible_null_derefs)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 2838, in check_refcounts
limits=limits)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2680, in iter_traces
transitions = curstate.get_transitions()
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1828, in get_transitions
return self._get_transitions_for_stmt(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1855, in _get_transitions_for_stmt
return self._get_transitions_for_GimpleAssign(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2308, in _get_transitions_for_GimpleAssign
value = self.eval_rhs(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2300, in eval_rhs
% (stmt.exprcode, stmt.exprcode, stmt.loc))
NotImplementedError: Don't know how to cope with exprcode: <type 'gcc.RealCst'> (<type 'gcc.RealCst'>) at ../../archer/gdb/python/py-value.c:1098
}}}

provide a way to indicate that function sets an exception

This is a "TODO" from the docs:

(TODO: provide a way to mark a function as setting this state)

gdb has some functions that return a value < 0 on error; in this case the python exception is set. This causes false reports from the checker.

In the meantime I may change these functions to return PyObject*, since I think the checker will handle this ok.

unhandled python exception in check_refcounts (AttributeError: 'ConcreteValue' object has no attribute 'region')

I got this unhandled Python exception when building gdb with the checker:
{{{
../../archer/gdb/python/py-breakpoint.c: In function ‘bppy_init’:
../../archer/gdb/python/py-breakpoint.c:631:5: error: Unhandled Python exception raised calling 'execute' method
Traceback (most recent call last):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 64, in execute
self._check_refcounts(fun)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 68, in _check_refcounts
self.show_possible_null_derefs)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 3017, in check_refcounts
if isinstance(return_value.region, RegionForGlobal):
AttributeError: 'ConcreteValue' object has no attribute 'region'
}}}

Failed to build on Ubuntu 15.04

I'm running Ubuntu 15.04, using 33d88ce

When I try to compile, I get these errors:

$ make
Makefile:193: warning: overriding recipe for target 'autogenerated-casts.c'
Makefile:190: warning: ignoring old recipe for target 'autogenerated-casts.c'
python generate-config-h.py -o autogenerated-config.h --gcc="cc" --plugindir="/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin"
Checking whether cc was built with C or C++... C++
checking for gcc-plugin.h... found
checking whether plugin.def defines PLUGIN_FINISH_DECL... yes
checking whether passes are C++ classes... yes
writing autogenerated-config.h
writing autogenerated-EXTRA_CFLAGS.txt
python testcpybuilder.py -v
test_module_with_type (__main__.SimpleTest) ... ok
test_simple_compilation (__main__.SimpleTest) ... ok
test_version_parsing (__main__.SimpleTest) ... ok

----------------------------------------------------------------------
Ran 3 tests in 0.266s

OK
cd gcc-c-api && make libgcc-c-api.so CC=cc
make[1]: Entering directory '/home/jml/src/gcc-python-plugin/gcc-c-api'
python xml-to-h.py
cc -O2 -Werror -g -fPIC -fno-strict-aliasing -Wall -I/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include -I/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/c-family -I.  -c -x c++ -fno-rtti -o gcc-callgraph.o gcc-callgraph.c
In file included from gcc-callgraph.c:29:0:
/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/gimple.h:283:10: error: use of enum ‘internal_fn’ without previous declaration
     enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
          ^
In file included from gcc-callgraph.c:29:0:
/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/gimple.h:1170:41: error: use of enum ‘internal_fn’ without previous declaration
 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
                                         ^
/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/gimple.h:1171:45: error: use of enum ‘internal_fn’ without previous declaration
 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
                                             ^
/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/gimple.h: In function ‘bool gimple_store_p(gimple)’:
/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/gimple.h:2346:36: error: ‘is_gimple_reg’ was not declared in this scope
   return lhs && !is_gimple_reg (lhs);
                                    ^
/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/gimple.h: At global scope:
/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/gimple.h:2444:20: error: use of enum ‘internal_fn’ without previous declaration
 static inline enum internal_fn
                    ^
/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/gimple.h:2544:46: error: use of enum ‘internal_fn’ without previous declaration
 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
                                              ^
/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/gimple.h: In function ‘tree_node* gimple_call_fndecl(const_gimple)’:
/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/gimple.h:2559:54: error: ‘gimple_call_addr_fndecl’ was not declared in this scope
   return gimple_call_addr_fndecl (gimple_call_fn (gs));
                                                      ^
/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/gimple.h: In function ‘tree_node* gimple_expr_type(const_gimple)’:
/usr/lib/gcc/x86_64-linux-gnu/4.9/plugin/include/gimple.h:5657:45: error: ‘IFN_MASK_STORE’ was not declared in this scope
        && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
                                             ^
Makefile:92: recipe for target 'gcc-callgraph.o' failed
make[1]: *** [gcc-callgraph.o] Error 1
make[1]: Leaving directory '/home/jml/src/gcc-python-plugin/gcc-c-api'
Makefile:152: recipe for target 'gcc-c-api/libgcc-c-api.so' failed
make: *** [gcc-c-api/libgcc-c-api.so] Error 2

Am using gcc 4.9:

$ gcc --version
gcc (Ubuntu 4.9.2-10ubuntu13) 4.9.2

Possibly related to https://fedorahosted.org/gcc-python-plugin/ticket/63

false reports due to gdb's exception mechanism

This report is incorrect:

../../archer/gdb/python/python.c: In function ‘gdbpy_parameter’:
../../archer/gdb/python/python.c:358:12: error: dereferencing uninitialized pointer: cmd.93->var at ../../archer/gdb/python/python.c:358 [-Werror]

I believe this happens because 'cmd' is initialized in a TRY_CATCH in gdb.

gdb has its own exception-handling system based on longjmp. TRY_CATCH is a tricky macro that expands to a doubly-nested loop; the loop will either exit via an exception (which in the function above we check for afterwards) or normally. However, there is no way to explain this invariant to the checker, which (I believe) assumes that the outer loop might run 0 times, causing it to think there are more code paths than are actually possible.

One idea for fixing this would be to let us provide a plugin to the plugin, to teach it about odd, program-specific situations like this.

uncaught TypeError within impl_PyList_Append when building gdb

When building gdb with the checker, I get this uncaught TypeError.

The line in question is:
{{{
PyObject *current_py_bp =
(PyObject *) current_bs->breakpoint_at->py_bp_object;
}}}
Here, py_bp_object has type 'struct breakpoint_object *',
which is derived from PyObject. However, this code
doesn't have access to the definition, it is an incomplete
type here.
{{{
../../archer/gdb/python/py-stopevent.c: In function ‘emit_stop_event’:
../../archer/gdb/python/py-stopevent.c:71:29: error: Unhandled Python exception raised calling 'execute' method
Traceback (most recent call last):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 64, in execute
self._check_refcounts(fun)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 68, in _check_refcounts
self.show_possible_null_derefs)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 2838, in check_refcounts
limits=limits)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2680, in iter_traces
transitions = curstate.get_transitions()
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1828, in get_transitions
return self._get_transitions_for_stmt(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1844, in _get_transitions_for_stmt
return self._get_transitions_for_GimpleCall(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1995, in _get_transitions_for_GimpleCall
return meth(stmt, *args)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 1514, in impl_PyList_Append
s_success.cpython.add_ref(v_newitem, stmt.loc)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 326, in add_ref
_incref_internal)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 300, in change_refcount
check_isinstance(pyobjectptr, PointerToRegion)
File "/home/tromey/Space/Trunk/gcc-python-plugin/gccutils.py", line 630, in check_isinstance
raise TypeError('%s / %r is not an instance of %s' % (obj, obj, types))
TypeError: unknown struct breakpoint_object * from ../../archer/gdb/python/py-stopevent.c:61 / UnknownValue(gcctype=<gcc.PointerType object at 0x19d7d80>, loc=gcc.Location(file='../../archer/gdb/python/py-stopevent.c', line=61)) is not an instance of <class 'libcpychecker.absinterp.PointerToRegion'>
}}}

FunctionDecl should have 'initial' attribute

Before there is a CFG, the body of a function is in
the function decl's DECL_INITIAL, as a block.
This field should be exposed to Python.

This patch adds the attribute, but isn't complete;
no tests or docs.

diff --git a/generate-tree-c.py b/generate-tree-c.py
index 2829b9e..64efaa7 100644
--- a/generate-tree-c.py
+++ b/generate-tree-c.py
@@ -497,6 +497,9 @@ def generate_tree_code_classes():
add_simple_getter('callgraph_node',
'gcc_python_make_wrapper_cgraph_node(cgraph_get_n
'The gcc.CallgraphNode for this function declarat

  •        add_simple_getter('initial',
    
  •                          'gcc_python_make_wrapper_tree(DECL_INITIAL(self->
    
  •                          "The body of this function as a gcc.Block, or Non
    
           for attr in ('public', 'private', 'protected', 'static'):
               getsettable.add_simple_getter(cu,
    

TypeError: (long int)val […] is not an instance of RefcountValue

Not sure if this is due to a an issue in my code, but at least I don't think it should raise an exception in cpychecker:

[fedora@fedora pylibacl]$ CC=~/gcc-python-plugin/gcc-with-cpychecker CFLAGS="--maxtrans=1000" ./setup.py build
running build
running build_ext
building 'posix1e' extension
/home/fedora/gcc-python-plugin/gcc-with-cpychecker -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv --maxtrans=1000 -fPIC -DHAVE_LINUX -DHAVE_LEVEL2 -I/usr/include/python2.7 -c acl.c -o build/temp.linux-x86_64-2.7/acl.o
acl.c: In function ‘initposix1e’:
acl.c:1807:9: error: Unhandled Python exception raised calling 'execute' method
     if (PyDict_SetItemString(d, "ACL",
         ^
Traceback (most recent call last):
  File "/home/fedora/gcc-python-plugin/libcpychecker/__init__.py", line 79, in execute
    self._check_refcounts(fun)
  File "/home/fedora/gcc-python-plugin/libcpychecker/__init__.py", line 85, in _check_refcounts
    dump_json=self.dump_json)
  File "/home/fedora/gcc-python-plugin/libcpychecker/refcounts.py", line 4393, in check_refcounts
    maxtrans)
  File "/home/fedora/gcc-python-plugin/libcpychecker/refcounts.py", line 4248, in impl_check_refcounts
    limits=limits)
  File "/home/fedora/gcc-python-plugin/libcpychecker/absinterp.py", line 3033, in iter_traces
    depth + 1):
[…]
  File "/home/fedora/gcc-python-plugin/libcpychecker/absinterp.py", line 3033, in iter_traces
    depth + 1):
  File "/home/fedora/gcc-python-plugin/libcpychecker/absinterp.py", line 2997, in iter_traces
    transitions = curstate.get_transitions()
  File "/home/fedora/gcc-python-plugin/libcpychecker/absinterp.py", line 2049, in get_transitions
    return self._get_transitions_for_stmt(stmt)
  File "/home/fedora/gcc-python-plugin/libcpychecker/absinterp.py", line 2065, in _get_transitions_for_stmt
    return self._get_transitions_for_GimpleCall(stmt)
  File "/home/fedora/gcc-python-plugin/libcpychecker/absinterp.py", line 2232, in _get_transitions_for_GimpleCall
    return meth(stmt, *args)
  File "/home/fedora/gcc-python-plugin/libcpychecker/refcounts.py", line 1632, in impl_PyDict_SetItemString
    v_dp, v_key, v_item)
  File "/home/fedora/gcc-python-plugin/libcpychecker/refcounts.py", line 1590, in _handle_PyDict_SetItem
    s_success.cpython.add_external_ref(v_item, stmt.loc)
  File "/home/fedora/gcc-python-plugin/libcpychecker/refcounts.py", line 607, in add_external_ref
    _incref_external)
  File "/home/fedora/gcc-python-plugin/libcpychecker/refcounts.py", line 572, in change_refcount
    check_isinstance(oldvalue, RefcountValue)
  File "/home/fedora/gcc-python-plugin/gccutils/__init__.py", line 637, in check_isinstance
    raise TypeError('%s / %r is not an instance of %s' % (obj, obj, types))
TypeError: (long int)val [-0x7fffffffffffffff <= val <= 0x7fffffffffffffff] from acl.c:1806 / WithinRange(gcctype='long int', loc=gcc.Location(file='acl.c', line=1806), minvalue=-0x7fffffffffffffff, maxvalue=0x7fffffffffffffff) is not an instance of <class 'libcpychecker.refcounts.RefcountValue'>

The code which triggers this is in iustin/pylibacl@1c1acd9.

The line in cause doesn't do anything with refcounts itself, so I don't know why it trips cpychecker. Tested in a Fedora21 cloud image. Thanks!

html v2: inline html dependencies

The html reports need to be usable as email or bugtracker attachments.
This means that <script src="myscript.js"> and <link rel="stylesheet" type="text/css" href="mystyle.css"> are inappropriate.

The fix is simple: inline the code rather than trying to http GET it.

"*" on pass names should maybe be ignored

In GCC, a "" at the beginning of a pass name means that the
pass manager should not create a dump file for that pass.
I think it might be better to ignore the "
" when looking up
passes in register_after and the like -- a "*" may be added or
removed, but the pass would remain the same.

only do reference count checking when Python.h is included

If I run cpychecker on gdb, I get many reports of the form:

../../src/gdb/arm-linux-tdep.c: In function ‘arm_linux_init_abi’:
../../src/gdb/arm-linux-tdep.c:1060:1: note: this function is too complicated for the reference-count checker to fully analyze: not all paths were analyzed

Many of these occur in files that do not use Python at all. As we discussed on the list, it would make sense for cpychecker to simply ignore compilations where Python.h is not included.

PLUGIN_ATTRIBUTES not documented

PLUGIN_ATTRIBUTES is referred to by some places in the docs,
but the main documentation for it in basics.rst is commented out.

html v2: optimize size a little

When designing the v2 html report, we didn't understand that it was meant to be a single standalone, attachable html file.

With this in mind, we should probably use zepto rather than jquery.

make index.html to easily browse all reports

Currently the plugin generates an HTML file for each
function that has some report. However, there is no
really easy way to browse all the reports. It would be nice
if the plugin updated an index.html file as it went along,
so that I could visit one file to see an overview of the
entire build.

RecordType not documented

I couldn't find documentation on RecordType or fields.
I read the autogenerated code, and gccutils.py,
to figure out what I needed.

unhandled python exception in impl_PyList_Append (AttributeError: 'UnknownValue' object has no attribute 'region')

I got this unhandled Python exception when building gdb with the plugin.
{{{
../../archer/gdb/python/py-breakpoint.c: In function ‘build_bp_list’:
../../archer/gdb/python/py-breakpoint.c:707:11: error: Unhandled Python exception raised calling 'execute' method
Traceback (most recent call last):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 64, in execute
self._check_refcounts(fun)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 68, in _check_refcounts
self.show_possible_null_derefs)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 2838, in check_refcounts
limits=limits)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2680, in iter_traces
transitions = curstate.get_transitions()
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1828, in get_transitions
return self._get_transitions_for_stmt(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1844, in _get_transitions_for_stmt
return self._get_transitions_for_GimpleCall(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1995, in _get_transitions_for_GimpleCall
return meth(stmt, *args)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 1517, in impl_PyList_Append
ob_item_region = self.state.make_field_region(v_op.region, 'ob_item')
AttributeError: 'UnknownValue' object has no attribute 'region'
}}}

html v2: generate by default

I plan to create *.v2.html files in tandem with the old .html reports.

Once we're happy with the correspondence between the two, we can make the v2 reports default and remove the v1 codes.

Most libcpychecker tests fail with gcc 4.6.3 with libcpychecker.compat.CouldNotFindVarDecl

I'm trying to build the gcc-python-plugin from master on Ubuntu 12.04, and I'm getting a large number of test failures and a project that doesn't work. I suspect I'm missing something. I've also tried it on Fedora 17, but got similar results.

The errors start here, full output is 2 megs or so.

tests/cpychecker/absinterp/comparisons/boundaries/ConcreteValue-lt-max-of-WithinRange: OK
tests/cpychecker/absinterp/comparisons/boundaries/ConcreteValue-lt-min-of-WithinRange: OK
tests/cpychecker/absinterp/comparisons/boundaries/ConcreteValue-lt-two-value-range: OK
tests/cpychecker/absinterp/comparisons/boundaries/WithinRange-eq-ConcreteValue-in-middle: OK
tests/cpychecker/absint--- Expected stdout (after cleaning)
+++ Actual stdout (after cleaning)
@@ -1,37 +0,0 @@
-Trace 0:
-  Transitions:
-    'when PyString_AsString() succeeds'
-    'releasing the GIL by calling PyEval_SaveThread()'
-    'reacquiring the GIL by calling PyEval_RestoreThread()'
-    'returning'
-  region for gcc.ParmDecl('self') on stack:
-    repr(): RegionOnStack("region for gcc.ParmDecl('self')")
-    str(): region for gcc.ParmDecl('self') on stack
-    r->ob_refcnt: refs: 0 + N where N >= 1
-    r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts
/GIL/correct/input.c', line=29), region=Region("region-for-type-of-arg-gcc.ParmDecl('self')"))
-  region for gcc.ParmDecl('args') on stack:
-    repr(): RegionOnStack("region for gcc.ParmDecl('args')")
-    str(): region for gcc.ParmDecl('args') on stack
-    r->ob_refcnt: refs: 0 + N where N >= 1
-    r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts
/GIL/correct/input.c', line=29), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
-  Exception:
-    (struct PyObject *)0 from tests/cpychecker/refcounts/GIL/correct/input.c:30
-
-Trace 1:
-  Transitions:
-    'when PyString_AsString() fails'
-    'releasing the GIL by calling PyEval_SaveThread()'
-    'reacquiring the GIL by calling PyEval_RestoreThread()'
-    'returning'
-  region for gcc.ParmDecl('self') on stack:
-    repr(): RegionOnStack("region for gcc.ParmDecl('self')")
-    str(): region for gcc.ParmDecl('self') on stack
-    r->ob_refcnt: refs: 0 + N where N >= 1
-    r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts
/GIL/correct/input.c', line=29), region=Region("region-for-type-of-arg-gcc.ParmDecl('self')"))
-  region for gcc.ParmDecl('args') on stack:
-    repr(): RegionOnStack("region for gcc.ParmDecl('args')")
-    str(): region for gcc.ParmDecl('args') on stack
-    r->ob_refcnt: refs: 0 + N where N >= 1
-    r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts
/GIL/correct/input.c', line=29), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
-  Exception:
-    (struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/GIL/corr
ect/input.c:31
--- Expected stderr (after cleaning)
+++ Actual stderr (after cleaning)
@@ -0,0 +1,28 @@

no way to look up a struct by tag

I could not find a way to look up a structure type by tag.
E.g., I wanted to look up 'struct buffer'.
I could do this by introducing typedefs, but I'd rather
not have to do that.

const_variant does not preserve other qualifiers

Running this simple plugin:

import gcc

def on_unit(*args, **kwargs):
    print gcc.Type.char()
    print gcc.Type.char().const_equivalent
    print gcc.Type.char().const_equivalent.volatile_equivalent

gcc.register_callback(gcc.PLUGIN_FINISH_UNIT, on_unit)

prints

bapiya. gcc-with-python2 qq.py -c q.c
char
const char
volatile char

That is, the const is dropped in the last case. I think the bug is not passing the current qualifiers to build_qualified_type.

did not link missing libmvec.so.1

Compiling on debian,

cc \
    -I/usr/lib/gcc/x86_64-linux-gnu/5/plugin/include -I/usr/lib/gcc/x86_64-linux-gnu/5/plugin/include/c-family -I. -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu/python2.7 -O2 -Werror -g -fPIC -fno-strict-aliasing -Wall  \
    -shared \
    gcc-python.o gcc-python-attribute.o gcc-python-callbacks.o gcc-python-callgraph.o gcc-python-cfg.o gcc-python-closure.o gcc-python-diagnostics.o gcc-python-function.o gcc-python-gimple.o gcc-python-location.o gcc-python-option.o gcc-python-parameter.o gcc-python-pass.o gcc-python-pretty-printer.o gcc-python-rtl.o gcc-python-tree.o gcc-python-variable.o gcc-python-version.o gcc-python-wrapper.o autogenerated-callgraph.o autogenerated-casts.o autogenerated-cfg.o autogenerated-option.o autogenerated-function.o autogenerated-gimple.o autogenerated-location.o autogenerated-parameter.o autogenerated-pass.o autogenerated-pretty-printer.o autogenerated-rtl.o autogenerated-tree.o autogenerated-variable.o \
    -o python.so \
    -lpython2.7 -lpthread -ldl  -lutil -lm  \
    -lgcc-c-api -Lgcc-c-api -Wl,-rpath=/usr/lib/gcc/x86_64-linux-gnu/5/plugin
/usr/bin/ld: cannot find /lib/x86_64-linux-gnu/libmvec.so.1
collect2: error: ld returned 1 exit status
Makefile:143: recipe for target 'python.so' failed

removing "-lm" got it to link.

checker uses too much memory in some cases

I limited the memory available to gcc to 1G, using ulimit. This causes the checker to die with a MemoryError when building gdb.

I think this is too much memory; but also, when I ran it unlimited, it ate up all the available memory and caused my machine to start thrashing.

Here's the trace from the MemoryError, in case it helps.
{{{
../../archer/gdb/arm-tdep.c:4667:34: error: Unhandled Python exception raised calling 'execute' method
Traceback (most recent call last):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 64, in execute
self._check_refcounts(fun)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 68, in _check_refcounts
self.show_possible_null_derefs)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 2838, in check_refcounts
limits=limits)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces
depth + 1):
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2680, in iter_traces
transitions = curstate.get_transitions()
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1828, in get_transitions
return self._get_transitions_for_stmt(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1855, in _get_transitions_for_stmt
return self._get_transitions_for_GimpleAssign(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2308, in _get_transitions_for_GimpleAssign
value = self.eval_rhs(stmt)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2251, in eval_rhs
c = a.eval_binop(stmt.exprcode, b, stmt.lhs.type, stmt.loc)
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 588, in eval_binop
eval_binop(exprcode, self.minvalue, rhs.maxvalue),
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 365, in eval_binop
result = inner()
File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 348, in inner
return a | b
MemoryError
}}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.