Swig 2.0.11 appears to be generating code that returns an uninitialized value.
$ uname -a
Darwin nickg-air11.local 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
$ which swig
/usr/local/bin/swig
$ swig -version
SWIG Version 2.0.11
Compiled with c++ [x86_64-apple-darwin12.5.0]
Configured options: +pcre
$cc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c libinjection/libinjection_wrap.c -o build/temp.macosx-10.8-x86_64-2.7/libinjection/libinjection_wrap.o
libinjection/libinjection_wrap.c:2886:9: warning: variable 'res' is used uninitialized whenever 'if' condition is true
[-Wsometimes-uninitialized]
if (PyType_Ready(tp) < 0)
^~~~~~~~~~~~~~~~~~~~
libinjection/libinjection_wrap.c:2910:10: note: uninitialized use occurs here
return res;
^~~
libinjection/libinjection_wrap.c:2886:5: note: remove the 'if' if its condition is always false
if (PyType_Ready(tp) < 0)
^~~~~~~~~~~~~~~~~~~~~~~~~
libinjection/libinjection_wrap.c:2867:10: note: initialize the variable 'res' to silence this warning
int res;
^
= 0
SWIGRUNTIME int
SWIG_Python_NonDynamicSetAttr(PyObject obj, PyObject name, PyObject value) {
PyTypeObject tp = obj->ob_type;
PyObject descr;
PyObject encoded_name;
descrsetfunc f;
int res; <--- NOT INITIALIZED
if (!tp->tp_dict) {
if (PyType_Ready(tp) < 0)
goto done; // <--- BOO
}
done:
Py_DECREF(name);
return res; // <--- BEEP BEEP
}
this report is incorrect.
My generated file is from an older SWIG, current swig seems ok.
Please close.
Diff:
this one is still valid.
make
swig -version
SWIG Version 2.0.11
Compiled with c++ [x86_64-apple-darwin12.5.0]
Configured options: +pcre
Please see http://www.swig.org for reporting bugs and further information
swig -lua libinjection.i
cc -O0 -g -Wall -Wextra -fPIC -fno-common -I. -I/usr/local/include/luajit-2.0 -L/usr/local/lib -lluajit-5.1 \
-dynamiclib libinjection_wrap.c libinjection_sqli.c -o libinjection.so
libinjection_wrap.c:1224:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
libinjection_wrap.c:1254:1: warning: control may reach end of non-void function [-Wreturn-type]
}
On 2013/10/18, at 2:48, William Fulton wsfulton@users.sf.net wrote:
Related
Bugs:
#1341