Unexpected seg. fault allocating a not-allocated array

Does the calling program have an explicit interface for this subroutine? I think that is necessary for allocatable dummy arguments. If there is a mismatch, then it can corrupt the allocation status of other arrays, even local ones.

If everything is working correctly, all of the local allocatable arrays in your subroutine should be deallocated upon entry, and automatically deallocated upon exit. Since you are testing the allocation status of some of those arrays and apparently finding some of them allocated upon entry, that is evidence that the allocation tables are being corrupted somehow.