Postgresql - Segmentation fault (core dumped)
I think the permissions are correct because otherwise you wouldn't have gotten here.

My guess is that a modification you have made has caused the problem.  This is particularly the case given that it is a segmentation fault.  What you really need to do is look at the call stack at the time the core was dumped and see if you can isolate where in the code this is happening, and then back track to see what modifications you have made may have caused this.  Given that you have modified the code, the first step is to check and see if you can reproduce as kgrittn says, but I am willing to bet that this will only show up with your modified code.

The next step is likely to be to run initdb inside a debugger and review the conditions at time of crash.  At this point standard C debugging practices are really your best bet.