-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Description
The following code:
subroutine s(n, a)
integer :: n, a(1:2**n)
end
causes f2py to crash with:
/tmp/tmprxk_Ew/src.linux-x86_64-2.7/f2py_bugmodule.c: In function ‘f2py_rout_f2py_bug_s’:
/tmp/tmprxk_Ew/src.linux-x86_64-2.7/f2py_bugmodule.c:217:15: error: invalid type argument of unary ‘’ (have ‘int’)
a_Dims[0]=2*n;
^
Original report: http://stackoverflow.com/questions/35156750/f2py-invalid-type-argument-of-unary
Full output:
f2py -c f2py_bug.f90 -m f2py_bug
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "f2py_bug" sources
f2py options: []
f2py:> /tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c
creating /tmp/tmplNikU7/src.linux-x86_64-2.7
Reading fortran codes...
Reading file 'f2py_bug.f90' (format:free)
Post-processing...
Block: f2py_bug
Block: s
Post-processing (stage 2)...
Building modules...
Building module "f2py_bug"...
Constructing wrapper function "s"...
s(n,a)
Wrote C/API module "f2py_bug" to file "/tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c"
adding '/tmp/tmplNikU7/src.linux-x86_64-2.7/fortranobject.c' to sources.
adding '/tmp/tmplNikU7/src.linux-x86_64-2.7' to include_dirs.
copying /usr/lib64/python2.7/site-packages/numpy/f2py/src/fortranobject.c -> /tmp/tmplNikU7/src.linux-x86_64-2.7
copying /usr/lib64/python2.7/site-packages/numpy/f2py/src/fortranobject.h -> /tmp/tmplNikU7/src.linux-x86_64-2.7
build_src: building npy-pkg config files
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize Gnu95FCompiler
Found executable /usr/bin/gfortran
customize Gnu95FCompiler
customize Gnu95FCompiler using build_ext
building 'f2py_bug' extension
compiling C sources
C compiler: gcc -pthread -fno-strict-aliasing -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPICcreating /tmp/tmplNikU7/tmp
creating /tmp/tmplNikU7/tmp/tmplNikU7
creating /tmp/tmplNikU7/tmp/tmplNikU7/src.linux-x86_64-2.7
compile options: '-I/tmp/tmplNikU7/src.linux-x86_64-2.7 -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c'
gcc: /tmp/tmplNikU7/src.linux-x86_64-2.7/fortranobject.c
In file included from /usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1781:0,
from /usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /usr/lib64/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from /tmp/tmplNikU7/src.linux-x86_64-2.7/fortranobject.h:13,
from /tmp/tmplNikU7/src.linux-x86_64-2.7/fortranobject.c:2:
/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by "
^
gcc: /tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c
In file included from /usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1781:0,
from /usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /usr/lib64/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from /tmp/tmplNikU7/src.linux-x86_64-2.7/fortranobject.h:13,
from /tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c:19:
/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by "
^
/tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c: In function ‘f2py_rout_f2py_bug_s’:
/tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c:217:15: error: invalid type argument of unary ‘’ (have ‘int’)
a_Dims[0]=2__n;
^
/tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c: At top level:
/tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c:105:12: warning: ‘f2py_size’ defined but not used [-Wunused-function]
static int f2py_size(PyArrayObject var, ...)
^
In file included from /usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1781:0,
from /usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /usr/lib64/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from /tmp/tmplNikU7/src.linux-x86_64-2.7/fortranobject.h:13,
from /tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c:19:
/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by "
^
/tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c: In function ‘f2py_rout_f2py_bug_s’:
/tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c:217:15: error: invalid type argument of unary ‘’ (have ‘int’)
a_Dims[0]=2__n;
^
/tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c: At top level:
/tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c:105:12: warning: ‘f2py_size’ defined but not used [-Wunused-function]
static int f2py_size(PyArrayObject var, ...)
^
error: Command "gcc -pthread -fno-strict-aliasing -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -I/tmp/tmplNikU7/src.linux-x86_64-2.7 -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c /tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.c -o /tmp/tmplNikU7/tmp/tmplNikU7/src.linux-x86_64-2.7/f2py_bugmodule.o" failed with exit status 1