[SciPy-user] f2py "Segmentation fault"-revisited, please help

David Cournapeau david@ar.media.kyoto-u.ac...
Thu Oct 30 23:52:59 CDT 2008

Kimberly Artita wrote:
> Hi,
> Can someone please tell me why I keep getting a segmentation fault?
> my fortran script (gfortran_test.f90):
> subroutine readin_test
>     implicit none
>     character(len=4) :: title (60)
>     character (len=13) :: bigsub, sbsout, rchout, rsvout, lwqout, wtrout
>     open (2,file="gfortran.txt", delim='none')
>     print *, "title"
>     read (2,5100) title
>     print *, title   
>     read (2,5000) bigsub, sbsout, rchout, rsvout, lwqout, wtrout
>     print *, "bigsub, sbsout, rchout, rsvout, lwqout, wtrout"
>     print *, bigsub, sbsout, rchout, rsvout, lwqout, wtrout
>     close(2)
>     5100 format (20a4)
>     5000 format (6a)

I don't know about the exact problem, but C/Fortran mixing is already
quite error prone and has many warts, and file IO is even worse (because
the C runtime and the fortran runtimes must cooperate in the same
process, and they generally don't cooperate well). You should avoid it
if you can.

> I can compile gfortran_test.f90 as a standalone program and it works!

Can you try with a main written in C (numpy is in C) ? I would not be
surprised if that's the issue,



More information about the SciPy-user mailing list