I am currently working on a python interface to spral including SSIDS. To this end, I am using the C bindings to the Fortran code of SSIDS located in interfaces/C/ssids.f90. I would prefer to use C indexing as it is the indexing underlying pythons numpy. However, my code crashes whenever I try to pass a matrix to spral_ssids_analyse with options.array_base = 0.
I think there is an error in the memory allocation that is causing the problem. Specifically, a segfault occurs at
reserves n + 1 entries rather than the required #nnz = fptr(fakeep%n+1)-1 to hold the array, causing an overflow. This seems to be done correctly in other places, for example here:
I am currently working on a python interface to spral including SSIDS. To this end, I am using the C bindings to the Fortran code of SSIDS located in
interfaces/C/ssids.f90
. I would prefer to use C indexing as it is the indexing underlying pythonsnumpy
. However, my code crashes whenever I try to pass a matrix tospral_ssids_analyse
withoptions.array_base = 0
.I think there is an error in the memory allocation that is causing the problem. Specifically, a segfault occurs at
https://github.com/ralna/spral/blob/master/interfaces/C/ssids.f90#L462
where a newly allocated array is initialized. The problem is that the allocation here
https://github.com/ralna/spral/blob/master/interfaces/C/ssids.f90#L461
reserves
n + 1
entries rather than the required#nnz = fptr(fakeep%n+1)-1
to hold the array, causing an overflow. This seems to be done correctly in other places, for example here:https://github.com/ralna/spral/blob/master/interfaces/C/ssids.f90#L184
Could you look into and fix this issue?