Of course there are many reasons that a program may crash, but a common reason is that the stack size is too small. If your program crashes as soon as you begin to execute it (I mean instantly!), this may be the problem. Try increasing the stacksize by typing:
>> limit stacksize n
where n is the size you'd like (in kbytes). You can see what the current size is by typing "limit" by itself:
peta.ecn.purdue.edu 52: limit cputime unlimited filesize unlimited datasize 2097148 kbytes stacksize 8192 kbytes coredumpsize unlimited vmemoryuse unlimited descriptors 64
Sometimes the backend compiler will warn you if it thinks that the stacksize is very large, other times it won't. It usually is a good idea to try increasing the stacksize before spending hours trying to find the "bug" in your program.