Hi David,
here is the new transcript after updating:
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.447s
OK
python run-test-suite.py
tests/plugin/identifiers: OK
tests/plugin/diagnostics: FAIL
returncode: 1
compiling: /usr/bin/i686-pc-linux-gnu-gcc-4.6.1 -ggdb -c -o
tests/plugin/diagnostics/output.o -fplugin=/home/denys/src/my-python-plugin/python.so
-fplugin-arg-python-script=tests/plugin/diagnostics/script.py -Wno-format
tests/plugin/diagnostics/input.c
Stdout:
Stderr:
tests/plugin/diagnostics/input.c: In function ‘main’:
tests/plugin/diagnostics/input.c:23:1: error: this is an error (with positional args)
tests/plugin/diagnostics/input.c:23:1: error: this is an error (with keyword args)
tests/plugin/diagnostics/input.c:25:1: warning: this is a warning (with positional
args) [-Wdiv-by-zero]
tests/plugin/diagnostics/input.c:25:1: warning: this is a warning (with keyword args)
[-Wdiv-by-zero]
tests/plugin/diagnostics/input.c:23:1: error: a warning with some embedded format
strings %s and %i
tests/plugin/diagnostics/input.c:23:1: note: This is the start of the function
tests/plugin/diagnostics/input.c:25:1: note: This is the end of the function---
Expected stderr
+++ Actual stderr
@@ -1,4 +1,4 @@
-tests/plugin/diagnostics/input.c: In function 'main':
+tests/plugin/diagnostics/input.c: In function ‘main’:
tests/plugin/diagnostics/input.c:23:1: error: this is an error (with positional args)
tests/plugin/diagnostics/input.c:23:1: error: this is an error (with keyword args)
tests/plugin/diagnostics/input.c:25:1: warning: this is a warning (with positional args)
[-Wdiv-by-zero]
tests/plugin/initializers: OK
tests/plugin/version: OK
tests/plugin/types: OK
tests/plugin/function-types: OK
tests/plugin/callback-exception: OK
tests/plugin/callback-args: OK
tests/plugin/syntax-error: OK
tests/plugin/options: FAIL
returncode: 1
compiling: /usr/bin/i686-pc-linux-gnu-gcc-4.6.1 -ggdb -c -o
tests/plugin/options/output.o -fplugin=/home/denys/src/my-python-plugin/python.so
-fplugin-arg-python-script=tests/plugin/options/script.py tests/plugin/options/input.c
Stdout:
Help on class Option in module gcc:
class Option(__builtin__.object)
| Methods defined here:
|
| __init__(...)
| x.__init__(...) initializes x; see help(type(x)) for signature
|
| __repr__(...)
| x.__repr__() <==> repr(x)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| help
| (string) The help text shown for this option
|
| is_driver
| (bool) Is this a driver option?
|
| is_enabled
| True/False for whether or not this option is enabled, raising a
NotImplementedError for options for which the plugin cannot tell
|
| is_optimization
| (bool) Does this option control an optimization?
|
| is_target
| (bool) Is this a target-specific option?
|
| is_warning
| (bool) Does this option control a warning message?
|
| text
| (string) The command-line text used to set this option
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __new__ = <built-in method __new__ of type object>
| T.__new__(S, ...) -> a new object with type S, a subtype of T
gcc.Option('-funroll-loops')
option.text: '-funroll-loops'
option.help: 'Perform loop unrolling when iteration count is known'
option.is_enabled: False
option.is_warning: False
option.is_optimization: True
option.is_driver: False
option.is_target: False
gcc.Option('-fjump-tables')
option.text: '-fjump-tables'
option.help: 'Use jump tables for sufficiently large switch statements'
option.is_enabled: True
option.is_warning: False
option.is_optimization: True
option.is_driver: False
option.is_target: False
gcc.Option('-Wuninitialized')
option.text: '-Wuninitialized'
option.help: 'Warn about uninitialized automatic variables'
option.is_enabled: True
option.is_warning: True
option.is_optimization: False
option.is_driver: False
option.is_target: False
gcc.Option('-Wformat')
option.text: '-Wformat'
option.help: 'Warn about printf/scanf/strftime/strfmon format string
anomalies'
option.is_enabled: True
option.is_warning: True
option.is_optimization: False
option.is_driver: False
option.is_target: False
Stderr:
Traceback (most recent call last):
File "tests/plugin/options/script.py", line 59, in <module>
option = gcc.Option('-foptimize-for-web-scale')
ValueError: Could not find command line argument with text
'-foptimize-for-web-scale'--- Expected stdout
+++ Actual stdout
@@ -66,7 +66,7 @@
gcc.Option('-Wformat')
option.text: '-Wformat'
option.help: 'Warn about printf/scanf/strftime/strfmon format string
anomalies'
- option.is_enabled: False
+ option.is_enabled: True
option.is_warning: True
option.is_optimization: False
option.is_driver: False
tests/plugin/parameters: OK
tests/plugin/sys: OK
tests/plugin/translation-units: OK
tests/plugin/functions: OK
tests/plugin/constants: OK
tests/plugin/arrays: OK
tests/cpychecker/unknown-function: OK
tests/cpychecker/absinterp/arrays: OK
tests/cpychecker/PyArg_ParseTuple/typedefs: OK
tests/cpychecker/PyArg_ParseTuple/keywords: FAIL
returncode: 1
compiling: /usr/bin/i686-pc-linux-gnu-gcc-4.6.1 -ggdb -c -o
tests/cpychecker/PyArg_ParseTuple/keywords/output.o
-fplugin=/home/denys/src/my-python-plugin/python.so
-fplugin-arg-python-script=tests/cpychecker/PyArg_ParseTuple/keywords/script.py
-I/usr/include/python2.7 tests/cpychecker/PyArg_ParseTuple/keywords/input.c
Stdout:
Stderr:
tests/cpychecker/PyArg_ParseTuple/keywords/input.c: In function ‘parse_to_a_typedef’:
tests/cpychecker/PyArg_ParseTuple/keywords/input.c:32:37: error: keywords to
PyArg_ParseTupleAndKeywords are not NULL-terminated [-fpermissive]--- Expected stderr
+++ Actual stderr
@@ -1,2 +1,2 @@
-tests/cpychecker/PyArg_ParseTuple/keywords/input.c: In function
'parse_to_a_typedef':
+tests/cpychecker/PyArg_ParseTuple/keywords/input.c: In function ‘parse_to_a_typedef’:
tests/cpychecker/PyArg_ParseTuple/keywords/input.c:32:37: error: keywords to
PyArg_ParseTupleAndKeywords are not NULL-terminated [-fpermissive]
tests/cpychecker/PyArg_ParseTuple/correct_codes_S_and_U: OK
tests/cpychecker/PyArg_ParseTuple/correct_converter: OK
tests/cpychecker/PyArg_ParseTuple/codes_accepting_null: OK
tests/cpychecker/PyArg_ParseTuple/incorrect_codes_S_and_U: FAIL
returncode: 1
compiling: /usr/bin/i686-pc-linux-gnu-gcc-4.6.1 -ggdb -c -o
tests/cpychecker/PyArg_ParseTuple/incorrect_codes_S_and_U/output.o
-fplugin=/home/denys/src/my-python-plugin/python.so
-fplugin-arg-python-script=tests/cpychecker/PyArg_ParseTuple/incorrect_codes_S_and_U/script.py
-I/usr/include/python2.7
tests/cpychecker/PyArg_ParseTuple/incorrect_codes_S_and_U/input.c
Stdout:
Stderr:
tests/cpychecker/PyArg_ParseTuple/incorrect_codes_S_and_U/input.c: In function
‘incorrect_usage_of_S_and_U’:
tests/cpychecker/PyArg_ParseTuple/incorrect_codes_S_and_U/input.c:29:26: error:
Mismatching type in call to PyArg_ParseTuple with format code "SU"
[-fpermissive]
argument 3 ("&val1") had type
"int *" (pointing to 32 bits)
but was expecting
one of "struct PyStringObject * *" or "struct PyObject * *"
for format code "S"
tests/cpychecker/PyArg_ParseTuple/incorrect_codes_S_and_U/input.c:29:26: error:
Mismatching type in call to PyArg_ParseTuple with format code "SU"
[-fpermissive]
argument 4 ("&val2") had type
"int *" (pointing to 32 bits)
but was expecting
one of "struct PyUnicodeObject * *" or "struct PyObject * *"
for format code "U"--- Expected stderr
+++ Actual stderr
@@ -1,4 +1,4 @@
-tests/cpychecker/PyArg_ParseTuple/incorrect_codes_S_and_U/input.c: In function
'incorrect_usage_of_S_and_U':
+tests/cpychecker/PyArg_ParseTuple/incorrect_codes_S_and_U/input.c: In function
‘incorrect_usage_of_S_and_U’:
tests/cpychecker/PyArg_ParseTuple/incorrect_codes_S_and_U/input.c:29:26: error:
Mismatching type in call to PyArg_ParseTuple with format code "SU"
[-fpermissive]
argument 3 ("&val1") had type
"int *" (pointing to 32 bits)
tests/cpychecker/PyArg_ParseTuple/incorrect_code_z_hash: FAIL
returncode: 1
compiling: /usr/bin/i686-pc-linux-gnu-gcc-4.6.1 -ggdb -c -o
tests/cpychecker/PyArg_ParseTuple/incorrect_code_z_hash/output.o
-fplugin=/home/denys/src/my-python-plugin/python.so
-fplugin-arg-python-script=tests/cpychecker/PyArg_ParseTuple/incorrect_code_z_hash/script.py
-I/usr/include/python2.7 tests/cpychecker/PyArg_ParseTuple/incorrect_code_z_hash/input.c
Stdout:
Stderr:
tests/cpychecker/PyArg_ParseTuple/incorrect_code_z_hash/input.c: In function
‘incorrect_code_z_hash’:
tests/cpychecker/PyArg_ParseTuple/incorrect_code_z_hash/input.c:34:26: error:
Mismatching type in call to PyArg_ParseTuple with format code "z#"
[-fpermissive]
argument 4 ("&len") had type
"float *" (pointing to 32 bits)
but was expecting
"int *" (pointing to 32 bits)
for format code "z#"--- Expected stderr
+++ Actual stderr
@@ -1,4 +1,4 @@
-tests/cpychecker/PyArg_ParseTuple/incorrect_code_z_hash/input.c: In function
'incorrect_code_z_hash':
+tests/cpychecker/PyArg_ParseTuple/incorrect_code_z_hash/input.c: In function
‘incorrect_code_z_hash’:
tests/cpychecker/PyArg_ParseTuple/incorrect_code_z_hash/input.c:34:26: error: Mismatching
type in call to PyArg_ParseTuple with format code "z#" [-fpermissive]
argument 4 ("&len") had type
"float *" (pointing to 32 bits)
tests/cpychecker/fileptr-missing-error-check: OK
tests/cpychecker/locate-methods: OK
tests/cpychecker/refcounts/correct_py_none: OK
tests/cpychecker/refcounts/correct_object_ctor: OK
tests/cpychecker/refcounts/incorrect_py_none: FAIL
returncode: 1
compiling: /usr/bin/i686-pc-linux-gnu-gcc-4.6.1 -ggdb -c -o
tests/cpychecker/refcounts/incorrect_py_none/output.o
-fplugin=/home/denys/src/my-python-plugin/python.so
-fplugin-arg-python-script=tests/cpychecker/refcounts/incorrect_py_none/script.py
-I/usr/include/python2.7 tests/cpychecker/refcounts/incorrect_py_none/input.c
Stdout:
_Py_NoneStruct.ob_refcnt: RefcountValue(0)
state.return_rvalue: PointerToRegion(gcctype='struct PyObject *', loc=None,
region=RegionForGlobal(gcc.VarDecl('_Py_NoneStruct')))
Stderr:
tests/cpychecker/refcounts/incorrect_py_none/input.c: In function
‘losing_refcnt_of_none’:
tests/cpychecker/refcounts/incorrect_py_none/input.c:26:5: error: ob_refcnt of return
value is 1 too low
tests/cpychecker/refcounts/incorrect_py_none/input.c:26:5: note: when returning at:
return Py_None;
tests/cpychecker/refcounts/incorrect_py_none/input.c:26:5: note: consider using
"Py_RETURN_NONE;"--- Expected stderr
+++ Actual stderr
@@ -1,4 +1,4 @@
-tests/cpychecker/refcounts/incorrect_py_none/input.c: In function
'losing_refcnt_of_none':
+tests/cpychecker/refcounts/incorrect_py_none/input.c: In function
‘losing_refcnt_of_none’:
tests/cpychecker/refcounts/incorrect_py_none/input.c:26:5: error: ob_refcnt of return
value is 1 too low
tests/cpychecker/refcounts/incorrect_py_none/input.c:26:5: note: when returning at:
return Py_None;
tests/cpychecker/refcounts/incorrect_py_none/input.c:26:5: note: consider using
"Py_RETURN_NONE;"
tests/cpychecker/refcounts/use_after_dealloc: FAIL
returncode: 1
compiling: /usr/bin/i686-pc-linux-gnu-gcc-4.6.1 -ggdb -c -o
tests/cpychecker/refcounts/use_after_dealloc/output.o
-fplugin=/home/denys/src/my-python-plugin/python.so
-fplugin-arg-python-script=tests/cpychecker/refcounts/use_after_dealloc/script.py
-I/usr/include/python2.7 tests/cpychecker/refcounts/use_after_dealloc/input.c
Stdout:
Trace 0:
Transitions:
'PyLong_FromLong() succeeds'
'taking False path'
'taking True path'
'returning'
Return value:
repr(): PointerToRegion(gcctype='struct PyObject *',
loc=gcc.Location(file='tests/cpychecker/refcounts/use_after_dealloc/input.c',
line=30), region=RegionOnHeap('PyLongObject',
gcc.Location(file='tests/cpychecker/refcounts/use_after_dealloc/input.c',
line=30)))
str(): (struct PyObject *)&RegionOnHeap('PyLongObject',
gcc.Location(file='tests/cpychecker/refcounts/use_after_dealloc/input.c',
line=30)) from tests/cpychecker/refcounts/use_after_dealloc/input.c:30
r->ob_refcnt: RefcountValue(1)
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *',
loc=gcc.Location(file='tests/cpychecker/refcounts/use_after_dealloc/input.c',
line=30), region=RegionForGlobal(gcc.VarDecl('PyLong_Type')))
Exception:
(struct PyObject *)0 from tests/cpychecker/refcounts/use_after_dealloc/input.c:28
Trace 1:
Transitions:
'PyLong_FromLong() succeeds'
'taking False path'
'taking False path'
'calling tp_dealloc on PyLongObject allocated at
tests/cpychecker/refcounts/use_after_dealloc/input.c:30'
error: ReadFromDeallocatedMemory()
error: reading from deallocated memory at
tests/cpychecker/refcounts/use_after_dealloc/input.c:42: memory deallocated at
tests/cpychecker/refcounts/use_after_dealloc/input.c:41
PyLongObject allocated at tests/cpychecker/refcounts/use_after_dealloc/input.c:30:
repr(): RegionOnHeap('PyLongObject',
gcc.Location(file='tests/cpychecker/refcounts/use_after_dealloc/input.c',
line=30))
str(): PyLongObject allocated at
tests/cpychecker/refcounts/use_after_dealloc/input.c:30
r->ob_refcnt: None
r->ob_type: None
Exception:
(struct PyObject *)0 from tests/cpychecker/refcounts/use_after_dealloc/input.c:28
Trace 2:
Transitions:
'PyLong_FromLong() fails'
'taking True path'
'returning'
Return value:
repr(): ConcreteValue(gcctype='struct PyObject *', loc=None, value=0L)
str(): (struct PyObject *)0L
Exception:
RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
Stderr:
tests/cpychecker/refcounts/use_after_dealloc/input.c: In function
‘use_after_dealloc’:
tests/cpychecker/refcounts/use_after_dealloc/input.c:42:5: error: reading from
deallocated memory at tests/cpychecker/refcounts/use_after_dealloc/input.c:42: memory
deallocated at tests/cpychecker/refcounts/use_after_dealloc/input.c:41
tests/cpychecker/refcounts/use_after_dealloc/input.c:30:15: note: when
PyLong_FromLong() succeeds at: PyObject *tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/use_after_dealloc/input.c:32:8: note: when taking False
path at: if (!tmp) {
tests/cpychecker/refcounts/use_after_dealloc/input.c:41:5: note: reaching:
Py_DECREF(tmp);
tests/cpychecker/refcounts/use_after_dealloc/input.c:41:5: note: when taking False
path at: Py_DECREF(tmp);
tests/cpychecker/refcounts/use_after_dealloc/input.c:41:5: note: reaching:
Py_DECREF(tmp);
tests/cpychecker/refcounts/use_after_dealloc/input.c:41:5: note: when calling
tp_dealloc on PyLongObject allocated at
tests/cpychecker/refcounts/use_after_dealloc/input.c:30 at: Py_DECREF(tmp);
tests/cpychecker/refcounts/use_after_dealloc/input.c:42:5: note: reaching:
Py_INCREF(tmp);--- Expected stderr
+++ Actual stderr
@@ -1,4 +1,4 @@
-tests/cpychecker/refcounts/use_after_dealloc/input.c: In function
'use_after_dealloc':
+tests/cpychecker/refcounts/use_after_dealloc/input.c: In function ‘use_after_dealloc’:
tests/cpychecker/refcounts/use_after_dealloc/input.c:42:5: error: reading from
deallocated memory at tests/cpychecker/refcounts/use_after_dealloc/input.c:42: memory
deallocated at tests/cpychecker/refcounts/use_after_dealloc/input.c:41
tests/cpychecker/refcounts/use_after_dealloc/input.c:30:15: note: when PyLong_FromLong()
succeeds at: PyObject *tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/use_after_dealloc/input.c:32:8: note: when taking False path
at: if (!tmp) {
tests/cpychecker/refcounts/too_many_increfs: FAIL
returncode: 1
compiling: /usr/bin/i686-pc-linux-gnu-gcc-4.6.1 -ggdb -c -o
tests/cpychecker/refcounts/too_many_increfs/output.o
-fplugin=/home/denys/src/my-python-plugin/python.so
-fplugin-arg-python-script=tests/cpychecker/refcounts/too_many_increfs/script.py
-I/usr/include/python2.7 tests/cpychecker/refcounts/too_many_increfs/input.c
Stdout:
Trace 0:
Transitions:
'PyLong_FromLong() succeeds'
'returning'
Return value:
repr(): PointerToRegion(gcctype='struct PyObject *',
loc=gcc.Location(file='tests/cpychecker/refcounts/too_many_increfs/input.c',
line=26), region=RegionOnHeap('PyLongObject',
gcc.Location(file='tests/cpychecker/refcounts/too_many_increfs/input.c',
line=26)))
str(): (struct PyObject *)&RegionOnHeap('PyLongObject',
gcc.Location(file='tests/cpychecker/refcounts/too_many_increfs/input.c', line=26))
from tests/cpychecker/refcounts/too_many_increfs/input.c:26
r->ob_refcnt: RefcountValue(2)
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *',
loc=gcc.Location(file='tests/cpychecker/refcounts/too_many_increfs/input.c',
line=26), region=RegionForGlobal(gcc.VarDecl('PyLong_Type')))
Exception:
(struct PyObject *)0 from tests/cpychecker/refcounts/too_many_increfs/input.c:24
Trace 1:
Transitions:
'PyLong_FromLong() fails'
error: NullPtrDereference()
error: dereferencing NULL (tmp->ob_refcnt) at
tests/cpychecker/refcounts/too_many_increfs/input.c:30
Exception:
RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
Stderr:
tests/cpychecker/refcounts/too_many_increfs/input.c: In function ‘too_many_increfs’:
tests/cpychecker/refcounts/too_many_increfs/input.c:31:5: error: ob_refcnt of return
value is 1 too high
tests/cpychecker/refcounts/too_many_increfs/input.c:26:9: note: PyLongObject allocated
at: tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/too_many_increfs/input.c:26:9: note: when PyLong_FromLong()
succeeds at: tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/too_many_increfs/input.c:31:5: note: when returning at:
return tmp;
tests/cpychecker/refcounts/too_many_increfs/input.c:30:5: error: dereferencing NULL
(tmp->ob_refcnt) at tests/cpychecker/refcounts/too_many_increfs/input.c:30
tests/cpychecker/refcounts/too_many_increfs/input.c:26:9: note: when PyLong_FromLong()
fails at: tmp = PyLong_FromLong(0x1000);--- Expected stderr
+++ Actual stderr
@@ -1,4 +1,4 @@
-tests/cpychecker/refcounts/too_many_increfs/input.c: In function
'too_many_increfs':
+tests/cpychecker/refcounts/too_many_increfs/input.c: In function ‘too_many_increfs’:
tests/cpychecker/refcounts/too_many_increfs/input.c:31:5: error: ob_refcnt of return
value is 1 too high
tests/cpychecker/refcounts/too_many_increfs/input.c:26:9: note: PyLongObject allocated
at: tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/too_many_increfs/input.c:26:9: note: when PyLong_FromLong()
succeeds at: tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/loop_n_times: OK
tests/cpychecker/refcounts/not_setting_exception: FAIL
returncode: 1
compiling: /usr/bin/i686-pc-linux-gnu-gcc-4.6.1 -ggdb -c -o
tests/cpychecker/refcounts/not_setting_exception/output.o
-fplugin=/home/denys/src/my-python-plugin/python.so
-fplugin-arg-python-script=tests/cpychecker/refcounts/not_setting_exception/script.py
-I/usr/include/python2.7 tests/cpychecker/refcounts/not_setting_exception/input.c
Stdout:
Trace 0:
Transitions:
'returning'
Return value:
repr(): ConcreteValue(gcctype='struct PyObject *', loc=None, value=0L)
str(): (struct PyObject *)0L
Exception:
(struct PyObject *)0 from
tests/cpychecker/refcounts/not_setting_exception/input.c:27
Stderr:
tests/cpychecker/refcounts/not_setting_exception/input.c: In function
‘not_setting_exception’:
tests/cpychecker/refcounts/not_setting_exception/input.c:32:5: error: returning
(PyObject*)NULL without setting an exception
tests/cpychecker/refcounts/not_setting_exception/input.c:32:5: note: when returning
at: return NULL;--- Expected stderr
+++ Actual stderr
@@ -1,3 +1,3 @@
-tests/cpychecker/refcounts/not_setting_exception/input.c: In function
'not_setting_exception':
+tests/cpychecker/refcounts/not_setting_exception/input.c: In function
‘not_setting_exception’:
tests/cpychecker/refcounts/not_setting_exception/input.c:32:5: error: returning
(PyObject*)NULL without setting an exception
tests/cpychecker/refcounts/not_setting_exception/input.c:32:5: note: when returning at:
return NULL;
tests/cpychecker/refcounts/returning_dead_object: FAIL
returncode: 1
compiling: /usr/bin/i686-pc-linux-gnu-gcc-4.6.1 -ggdb -c -o
tests/cpychecker/refcounts/returning_dead_object/output.o
-fplugin=/home/denys/src/my-python-plugin/python.so
-fplugin-arg-python-script=tests/cpychecker/refcounts/returning_dead_object/script.py
-I/usr/include/python2.7 tests/cpychecker/refcounts/returning_dead_object/input.c
Stdout:
Trace 0:
Transitions:
'PyLong_FromLong() succeeds'
'taking False path'
'taking True path'
'returning'
Return value:
repr(): PointerToRegion(gcctype='struct PyObject *',
loc=gcc.Location(file='tests/cpychecker/refcounts/returning_dead_object/input.c',
line=29), region=RegionOnHeap('PyLongObject',
gcc.Location(file='tests/cpychecker/refcounts/returning_dead_object/input.c',
line=29)))
str(): (struct PyObject *)&RegionOnHeap('PyLongObject',
gcc.Location(file='tests/cpychecker/refcounts/returning_dead_object/input.c',
line=29)) from tests/cpychecker/refcounts/returning_dead_object/input.c:29
r->ob_refcnt: RefcountValue(0)
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *',
loc=gcc.Location(file='tests/cpychecker/refcounts/returning_dead_object/input.c',
line=29), region=RegionForGlobal(gcc.VarDecl('PyLong_Type')))
Exception:
(struct PyObject *)0 from
tests/cpychecker/refcounts/returning_dead_object/input.c:27
Trace 1:
Transitions:
'PyLong_FromLong() succeeds'
'taking False path'
'taking False path'
'calling tp_dealloc on PyLongObject allocated at
tests/cpychecker/refcounts/returning_dead_object/input.c:29'
'returning'
Return value:
repr(): PointerToRegion(gcctype='struct PyObject *',
loc=gcc.Location(file='tests/cpychecker/refcounts/returning_dead_object/input.c',
line=29), region=RegionOnHeap('PyLongObject',
gcc.Location(file='tests/cpychecker/refcounts/returning_dead_object/input.c',
line=29)))
str(): (struct PyObject *)&RegionOnHeap('PyLongObject',
gcc.Location(file='tests/cpychecker/refcounts/returning_dead_object/input.c',
line=29)) from tests/cpychecker/refcounts/returning_dead_object/input.c:29
r->ob_refcnt: None
r->ob_type: None
Exception:
(struct PyObject *)0 from
tests/cpychecker/refcounts/returning_dead_object/input.c:27
Trace 2:
Transitions:
'PyLong_FromLong() fails'
'taking True path'
'returning'
Return value:
repr(): ConcreteValue(gcctype='struct PyObject *', loc=None, value=0L)
str(): (struct PyObject *)0L
Exception:
RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
Stderr:
tests/cpychecker/refcounts/returning_dead_object/input.c: In function
‘returning_dead_object’:
tests/cpychecker/refcounts/returning_dead_object/input.c:43:1: error: ob_refcnt of
return value is 1 too low
tests/cpychecker/refcounts/returning_dead_object/input.c:29:15: note: PyLongObject
allocated at: PyObject *tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/returning_dead_object/input.c:29:15: note: when
PyLong_FromLong() succeeds at: PyObject *tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/returning_dead_object/input.c:31:8: note: when taking False
path at: if (!tmp) {
tests/cpychecker/refcounts/returning_dead_object/input.c:39:5: note: reaching:
Py_DECREF(tmp);
tests/cpychecker/refcounts/returning_dead_object/input.c:39:5: note: when taking True
path at: Py_DECREF(tmp);
tests/cpychecker/refcounts/returning_dead_object/input.c:42:5: note: reaching:
return tmp;
tests/cpychecker/refcounts/returning_dead_object/input.c:43:1: note: when returning
tests/cpychecker/refcounts/returning_dead_object/input.c:43:1: error: returning
pointer to deallocated memory
tests/cpychecker/refcounts/returning_dead_object/input.c:29:15: note: when
PyLong_FromLong() succeeds at: PyObject *tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/returning_dead_object/input.c:31:8: note: when taking False
path at: if (!tmp) {
tests/cpychecker/refcounts/returning_dead_object/input.c:39:5: note: reaching:
Py_DECREF(tmp);
tests/cpychecker/refcounts/returning_dead_object/input.c:39:5: note: when taking False
path at: Py_DECREF(tmp);
tests/cpychecker/refcounts/returning_dead_object/input.c:39:5: note: reaching:
Py_DECREF(tmp);
tests/cpychecker/refcounts/returning_dead_object/input.c:39:5: note: when calling
tp_dealloc on PyLongObject allocated at
tests/cpychecker/refcounts/returning_dead_object/input.c:29 at: Py_DECREF(tmp);
tests/cpychecker/refcounts/returning_dead_object/input.c:42:5: note: reaching:
return tmp;
tests/cpychecker/refcounts/returning_dead_object/input.c:43:1: note: when returning
tests/cpychecker/refcounts/returning_dead_object/input.c:39:5: note: memory
deallocated here--- Expected stderr
+++ Actual stderr
@@ -1,4 +1,4 @@
-tests/cpychecker/refcounts/returning_dead_object/input.c: In function
'returning_dead_object':
+tests/cpychecker/refcounts/returning_dead_object/input.c: In function
‘returning_dead_object’:
tests/cpychecker/refcounts/returning_dead_object/input.c:43:1: error: ob_refcnt of return
value is 1 too low
tests/cpychecker/refcounts/returning_dead_object/input.c:29:15: note: PyLongObject
allocated at: PyObject *tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/returning_dead_object/input.c:29:15: note: when
PyLong_FromLong() succeeds at: PyObject *tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/unrecognized_function: OK
tests/cpychecker/refcounts/correct_decref: OK
tests/cpychecker/refcounts/missing_decref: FAIL
returncode: 1
compiling: /usr/bin/i686-pc-linux-gnu-gcc-4.6.1 -ggdb -c -o
tests/cpychecker/refcounts/missing_decref/output.o
-fplugin=/home/denys/src/my-python-plugin/python.so
-fplugin-arg-python-script=tests/cpychecker/refcounts/missing_decref/script.py
-I/usr/include/python2.7 tests/cpychecker/refcounts/missing_decref/input.c
Stdout:
Trace 0:
Transitions:
'PyList_New() succeeds'
'taking False path'
'PyLong_FromLong() succeeds'
'taking False path'
'PyList_SetItem() succeeds'
'returning'
Return value:
repr(): PointerToRegion(gcctype='struct PyObject *',
loc=gcc.Location(file='tests/cpychecker/refcounts/missing_decref/input.c',
line=27), region=RegionOnHeap('PyListObject',
gcc.Location(file='tests/cpychecker/refcounts/missing_decref/input.c', line=27)))
str(): (struct PyObject *)&RegionOnHeap('PyListObject',
gcc.Location(file='tests/cpychecker/refcounts/missing_decref/input.c', line=27))
from tests/cpychecker/refcounts/missing_decref/input.c:27
r->ob_refcnt: RefcountValue(1)
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *',
loc=gcc.Location(file='tests/cpychecker/refcounts/missing_decref/input.c',
line=27), region=RegionForGlobal(gcc.VarDecl('PyList_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/missing_decref/input.c:30:
repr(): RegionOnHeap('PyLongObject',
gcc.Location(file='tests/cpychecker/refcounts/missing_decref/input.c', line=30))
str(): PyLongObject allocated at
tests/cpychecker/refcounts/missing_decref/input.c:30
r->ob_refcnt: RefcountValue(0)
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *',
loc=gcc.Location(file='tests/cpychecker/refcounts/missing_decref/input.c',
line=30), region=RegionForGlobal(gcc.VarDecl('PyLong_Type')))
Exception:
(struct PyObject *)0 from tests/cpychecker/refcounts/missing_decref/input.c:24
Trace 1:
Transitions:
'PyList_New() succeeds'
'taking False path'
'PyLong_FromLong() fails'
'taking True path'
'returning'
Return value:
repr(): ConcreteValue(gcctype='struct PyObject *', loc=None, value=0L)
str(): (struct PyObject *)0L
PyListObject allocated at tests/cpychecker/refcounts/missing_decref/input.c:27:
repr(): RegionOnHeap('PyListObject',
gcc.Location(file='tests/cpychecker/refcounts/missing_decref/input.c', line=27))
str(): PyListObject allocated at
tests/cpychecker/refcounts/missing_decref/input.c:27
r->ob_refcnt: RefcountValue(1)
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *',
loc=gcc.Location(file='tests/cpychecker/refcounts/missing_decref/input.c',
line=27), region=RegionForGlobal(gcc.VarDecl('PyList_Type')))
Exception:
RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
Trace 2:
Transitions:
'PyList_New() fails'
'taking True path'
'returning'
Return value:
repr(): ConcreteValue(gcctype='struct PyObject *', loc=None, value=0L)
str(): (struct PyObject *)0L
Exception:
RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
Stderr:
tests/cpychecker/refcounts/missing_decref/input.c: In function ‘missing_decref’:
tests/cpychecker/refcounts/missing_decref/input.c:38:1: error: ob_refcnt of
PyListObject is 1 too high
tests/cpychecker/refcounts/missing_decref/input.c:27:10: note: PyListObject allocated
at: list = PyList_New(1);
tests/cpychecker/refcounts/missing_decref/input.c:27:10: note: when PyList_New()
succeeds at: list = PyList_New(1);
tests/cpychecker/refcounts/missing_decref/input.c:28:8: note: when taking False path
at: if (!list)
tests/cpychecker/refcounts/missing_decref/input.c:30:10: note: reaching: item =
PyLong_FromLong(42);
tests/cpychecker/refcounts/missing_decref/input.c:30:10: note: when PyLong_FromLong()
fails at: item = PyLong_FromLong(42);
tests/cpychecker/refcounts/missing_decref/input.c:33:8: note: when taking True path
at: if (!item)
tests/cpychecker/refcounts/missing_decref/input.c:34:9: note: reaching: return
NULL;
tests/cpychecker/refcounts/missing_decref/input.c:38:1: note: when returning---
Expected stderr
+++ Actual stderr
@@ -1,4 +1,4 @@
-tests/cpychecker/refcounts/missing_decref/input.c: In function 'missing_decref':
+tests/cpychecker/refcounts/missing_decref/input.c: In function ‘missing_decref’:
tests/cpychecker/refcounts/missing_decref/input.c:38:1: error: ob_refcnt of PyListObject
is 1 too high
tests/cpychecker/refcounts/missing_decref/input.c:27:10: note: PyListObject allocated at:
list = PyList_New(1);
tests/cpychecker/refcounts/missing_decref/input.c:27:10: note: when PyList_New() succeeds
at: list = PyList_New(1);
tests/cpychecker/refcounts/fold_conditional: OK
tests/cpychecker/refcounts/object_leak: FAIL
returncode: 1
compiling: /usr/bin/i686-pc-linux-gnu-gcc-4.6.1 -ggdb -c -o
tests/cpychecker/refcounts/object_leak/output.o
-fplugin=/home/denys/src/my-python-plugin/python.so
-fplugin-arg-python-script=tests/cpychecker/refcounts/object_leak/script.py
-I/usr/include/python2.7 tests/cpychecker/refcounts/object_leak/input.c
Stdout:
Trace 0:
returned: ConcreteValue(gcctype='struct PyObject *', loc=None, value=0L)
Trace 1:
returned: ConcreteValue(gcctype='struct PyObject *', loc=None, value=0L)
Stderr:
tests/cpychecker/refcounts/object_leak/input.c: In function ‘object_leak’:
tests/cpychecker/refcounts/object_leak/input.c:29:5: error: ob_refcnt of PyLongObject
is 1 too high
tests/cpychecker/refcounts/object_leak/input.c:26:15: note: PyLongObject allocated at:
PyObject *tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/object_leak/input.c:26:15: note: when PyLong_FromLong()
succeeds at: PyObject *tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/object_leak/input.c:29:5: note: when returning at:
return NULL;
tests/cpychecker/refcounts/object_leak/input.c:29:5: error: returning (PyObject*)NULL
without setting an exception
tests/cpychecker/refcounts/object_leak/input.c:26:15: note: when PyLong_FromLong()
succeeds at: PyObject *tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/object_leak/input.c:29:5: note: when returning at:
return NULL;--- Expected stderr
+++ Actual stderr
@@ -1,4 +1,4 @@
-tests/cpychecker/refcounts/object_leak/input.c: In function 'object_leak':
+tests/cpychecker/refcounts/object_leak/input.c: In function ‘object_leak’:
tests/cpychecker/refcounts/object_leak/input.c:29:5: error: ob_refcnt of PyLongObject is
1 too high
tests/cpychecker/refcounts/object_leak/input.c:26:15: note: PyLongObject allocated at:
PyObject *tmp = PyLong_FromLong(0x1000);
tests/cpychecker/refcounts/object_leak/input.c:26:15: note: when PyLong_FromLong()
succeeds at: PyObject *tmp = PyLong_FromLong(0x1000);
tests/examples/hello-world: OK
29 successes; 12 failures
Failed tests:
tests/plugin/diagnostics
tests/plugin/options
tests/cpychecker/PyArg_ParseTuple/keywords
tests/cpychecker/PyArg_ParseTuple/incorrect_codes_S_and_U
tests/cpychecker/PyArg_ParseTuple/incorrect_code_z_hash
tests/cpychecker/refcounts/incorrect_py_none
tests/cpychecker/refcounts/use_after_dealloc
tests/cpychecker/refcounts/too_many_increfs
tests/cpychecker/refcounts/not_setting_exception
tests/cpychecker/refcounts/returning_dead_object
tests/cpychecker/refcounts/missing_decref
tests/cpychecker/refcounts/object_leak
make: *** [test-suite] Error 1
--Denys