[Numpy-tickets] [NumPy] #587: f2py fails on INTEGER(8) return statement in f90 code

NumPy numpy-tickets@scipy....
Sun Oct 7 04:45:15 CDT 2007


#587: f2py fails on INTEGER(8) return statement in f90 code
------------------------+---------------------------------------------------
 Reporter:  tovrstra    |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:          
Component:  numpy.f2py  |     Version:  none    
 Severity:  normal      |    Keywords:          
------------------------+---------------------------------------------------
 This is the example code:

 {{{
 MODULE fc
 IMPLICIT NONE
 CONTAINS
     SUBROUTINE color_stat(valsg, valsp, alphasg, alphasp, result, n)
 !f2py   intent(hide) n
         INTEGER(1),DIMENSION(n),INTENT(in) :: valsg, valsp, alphasg,
 alphasp
         INTEGER(8),INTENT(out),DIMENSION(256,3) :: result
         ! local vars
         INTEGER :: i, n, weight

         result(:,:) = 0
         DO i=1,n
             weight = alphasg(n)*alphasp(n)
             IF (weight > 0) THEN
                 result(valsp(n),1) = result(valsp(n),1) + weight
                 result(valsp(n),2) = result(valsp(n),2) + valsg(n)*weight
                 result(valsp(n),3) = result(valsp(n),3) +
 valsg(n)*valsg(n)*weight
             END IF
         END DO

     END SUBROUTINE
 END MODULE
 }}}

 When I try to make a module with f2py, I get this:

 {{{
 toon@poony ~/tmp/trevi $ f2py -m helpers -c helpers.f90
 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
 building extension "helpers" sources
 f2py options: []
 f2py:> /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c
 creating /tmp/tmpR6Rx7w
 creating /tmp/tmpR6Rx7w/src.linux-i686-2.4
 Reading fortran codes...
         Reading file 'helpers.f90' (format:free)
 Post-processing...
         Block: helpers
                         Block: fsim
                                 Block: color_stat
 Post-processing (stage 2)...
         Block: helpers
                 Block: unknown_interface
                         Block: fsim
                                 Block: color_stat
 Building modules...
         Building module "helpers"...
                 Constructing F90 module support for "fsim"...
                         Constructing wrapper function "fsim.color_stat"...
                           result = color_stat(valsg,valsp,alphasg,alphasp)
         Wrote C/API module "helpers" to file
 "/tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c"
         Fortran 90 wrappers are saved to
 "/tmp/tmpR6Rx7w/src.linux-i686-2.4/helpers-f2pywrappers2.f90"
   adding '/tmp/tmpR6Rx7w/src.linux-i686-2.4/fortranobject.c' to sources.
   adding '/tmp/tmpR6Rx7w/src.linux-i686-2.4' to include_dirs.
 copying /usr/lib/python2.4/site-packages/numpy/f2py/src/fortranobject.c ->
 /tmp/tmpR6Rx7w/src.linux-i686-2.4
 copying /usr/lib/python2.4/site-packages/numpy/f2py/src/fortranobject.h ->
 /tmp/tmpR6Rx7w/src.linux-i686-2.4
   adding '/tmp/tmpR6Rx7w/src.linux-i686-2.4/helpers-f2pywrappers2.f90' to
 sources.
 running build_ext
 customize UnixCCompiler
 customize UnixCCompiler using build_ext
 customize GnuFCompiler
 Could not locate executable g77
 Could not locate executable f77
 Could not locate executable ifort
 Could not locate executable ifc
 Could not locate executable ifort
 Could not locate executable efort
 Could not locate executable efc
 Could not locate executable ifort
 Could not locate executable efort
 Could not locate executable efc
 customize IntelFCompiler
 customize LaheyFCompiler
 customize PGroupFCompiler
 customize AbsoftFCompiler
 customize NAGFCompiler
 customize VastFCompiler
 customize GnuFCompiler
 Could not locate executable g77
 Could not locate executable f77
 customize CompaqFCompiler
 customize IntelItaniumFCompiler
 customize IntelEM64TFCompiler
 customize Gnu95FCompiler
 Could not locate executable f95
 customize Gnu95FCompiler
 Could not locate executable f95
 customize Gnu95FCompiler using build_ext
 building 'helpers' extension
 compiling C sources
 C compiler: i686-pc-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG
 -fPIC

 creating /tmp/tmpR6Rx7w/tmp
 creating /tmp/tmpR6Rx7w/tmp/tmpR6Rx7w
 creating /tmp/tmpR6Rx7w/tmp/tmpR6Rx7w/src.linux-i686-2.4
 compile options: '-I/tmp/tmpR6Rx7w/src.linux-i686-2.4 -I/usr/lib/python2.4
 /site-packages/numpy/core/include -I/usr/include/python2.4 -c'
 i686-pc-linux-gnu-gcc: /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:136: error: expected
 declaration specifiers or ‘...’ before ‘long_long’
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c: In function
 ‘f2py_rout_helpers_fsim_color_stat’:
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:165: error: ‘long_long’
 undeclared (first use in this function)
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:165: error: (Each
 undeclared identifier is reported only once
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:165: error: for each
 function it appears in.)
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:165: error: ‘result’
 undeclared (first use in this function)
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:190: error: expected
 expression before ‘)’ token
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:240: error: too many
 arguments to function ‘f2py_func’
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:136: error: expected
 declaration specifiers or ‘...’ before ‘long_long’
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c: In function
 ‘f2py_rout_helpers_fsim_color_stat’:
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:165: error: ‘long_long’
 undeclared (first use in this function)
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:165: error: (Each
 undeclared identifier is reported only once
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:165: error: for each
 function it appears in.)
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:165: error: ‘result’
 undeclared (first use in this function)
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:190: error: expected
 expression before ‘)’ token
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c:240: error: too many
 arguments to function ‘f2py_func’
 error: Command "i686-pc-linux-gnu-gcc -pthread -fno-strict-aliasing
 -DNDEBUG -fPIC -I/tmp/tmpR6Rx7w/src.linux-i686-2.4 -I/usr/lib/python2.4
 /site-packages/numpy/core/include -I/usr/include/python2.4 -c
 /tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.c -o
 /tmp/tmpR6Rx7w/tmp/tmpR6Rx7w/src.linux-i686-2.4/helpersmodule.o" failed
 with exit status 1
 }}}

 When I replace INTEGER(8) by INTEGER(4) in the example code, f2py works
 fine.

 Some system info:
 numpy-1.0.3.1
 compiled with gcc version 4.1.2 (Gentoo 4.1.2)

 P.S. I can not select the right numpy version from the new ticket form.

-- 
Ticket URL: <http://scipy.org/scipy/numpy/ticket/587>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list