# Exit code -9 when running simulation

**URL:** <https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114>\
**Category:** User Support\
**Created:** [November 25, 2014, 12:23am UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114 "2014-11-25T00:23:52Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [December 18, 2014, 12:21pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/21 "2014-12-18T12:21:21Z")

</div>

It’s worth considering. Can you do an ldd on your openmc executable and send the output here?

---

<div class="post-metadata">

**Author:** ![John\_Xia](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@John\_Xia](https://openmc.discourse.group/u/John_Xia)\
**Post date:** [December 19, 2014, 6:45pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/22 "2014-12-19T18:45:09Z")

</div>

I originally sent this only to Paul and not the whole thread.

ldd $(which openmc)  
linux-vdso.so.1 (0x00007fffaa1f7000)  
libgfortran.so.3 =\> /usr/lib/libgfortran.so.3 (0x00002b13b173e000)  
libm.so.6 =\> /usr/lib/libm.so.6 (0x00002b13b1a65000)  
libgcc\_s.so.1 =\> /usr/lib/libgcc\_s.so.1 (0x00002b13b1d6a000)  
libquadmath.so.0 =\> /usr/lib/libquadmath.so.0 (0x00002b13b1f80000)  
libc.so.6 =\> /usr/lib/libc.so.6 (0x00002b13b21bd000)  
/lib64/ld-linux-x86-64.so.2 (0x00002b13b151a000)

---

<div class="post-metadata">

**Author:** ![Anthony\_Scopatz](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Anthony\_Scopatz](https://openmc.discourse.group/u/Anthony_Scopatz)\
**Post date:** [December 19, 2014, 6:49pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/23 "2014-12-19T18:49:34Z")

</div>

Hi John, Paul,

I have the same ldd.

Be Well  
Anthony

---

<div class="post-metadata">

**Author:** ![John\_Xia](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@John\_Xia](https://openmc.discourse.group/u/John_Xia)\
**Post date:** [January 5, 2015, 3:01am UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/24 "2015-01-05T03:01:24Z")

</div>

Ok, I managed to get rid of the segfault. But I’m not sure what I did is legit.

On line 1839 of tally.F90, in subroutine get\_scoring\_bins, we have the following code:

case (FILTER\_MATERIAL)  
matching\_bins(i) = get\_next\_bin(FILTER\_MATERIAL, &  
p % material, i\_tally)

When we call this with p % material = -1, which seems to indicate a void material, we end up with filter\_value = -1 in line 2247:

n = size(tally\_maps(filter\_type) % items(filter\_value) % elements)

Which then segfaults because we’re trying to index by -1.

So what I’ve done is wrap that get\_next\_bin call in an if statement:

case (FILTER\_MATERIAL)  
if (p % material /= MATERIAL\_VOID) then  
matching\_bins(i) = get\_next\_bin(FILTER\_MATERIAL, &  
p % material, i\_tally)  
endif

This gets rid of this segfault on my machine. Am I committing any egregious crimes against physics? Or is this OK?

John

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [January 5, 2015, 11:59pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/25 "2015-01-05T23:59:38Z")

</div>

No egregious crimes with that fix at all; that’s exactly what I would have done. I finally reproduced the error too – not sure why I wasn’t getting it before. Do you want to submit a PR fixing this? I could do it myself, but then I need someone else to review it. If you submit, I can review it.

Thanks!!

[Previous page](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114.md?page=1)
