I’ve done a little more digging on this, so here’s an info dump. I ask of you:
-
What debugger do you recommend/use?
-
Any idea why we are getting this error?
I’m still on the dev branch, and the segfault is still occuring here:
At line 2247 of file /home/john/openmc/src/tally.F90
Fortran runtime error: Index ‘-1’ of dimension 1 of array ‘tally_maps%items’ below lower bound of 1
I have done the following:
-
acquired MCNP - we were wondering if the culprit was the NNDC data, so I got MCNP and used their cross-sections instead. I still get the same segfault, at the same place in the code. So I guess it wasn’t a difference in the data.
-
run OpenMC with gdb:
I set a breakpoint at line 2247 of tally.F90 on the develop branch, where the error occurs. The erroring line is:
! Check how many elements there are for this item
n = size(tally_maps(filter_type) % items(filter_value) % elements)
When I tell gdb to p tally_maps or anything related (tally_maps(filter_type), etc) it gives me Unhandled dwarf expression opcode 0x97.
Here are the local variables at this point.
@(gdb) info locals
bin = 0
i_tally_check = 1076252894
n = 2
Additionally, I checked filter_value, since that’s what we’re indexing tally_maps%items by.
@(gdb) p filter_value
$3 = 1
That’s not -1! Here is filter_type, the other thing we’re indexing by, for good measure.
@(gdb) p filter_type
$4 = 2
I noticed a few lines earlier (2241) that we check to see if tally_maps(filter_type) % items(filter_value) % elements is allocated at all:
! If there are no scoring bins for this item, then return immediately
if (.not. allocated(tally_maps(filter_type) % items(filter_value) % elements)) then
bin = NO_BIN_FOUND
return
end if
(NO_BIN_FOUND is -1.) So I checked if this check was working. I expected this command to output .TRUE. :
@(gdb) p allocated(tally_maps(filter_type) % items(filter_value) % elements)
No symbol “allocated” in current context.
That’s strange - I think this might be an issue with GDB where it doesn’t know what “allocated” means. I searched around on Google and SO and have gotten some vague recommendations for Archer GDB which has “better Fortran support” but nobody with this specific issue.
Thanks!
John