My Fortran program runs correctly when the binary is built with armflang at -O3 level, but encounters a runtime crash or segfault with -Ofast optimization level.
Test to see if the segfault disappears when you add the -fno-stack-arrays option at the compilation with armflang. See more information about this issue in the Arm Fortran Compiler troubleshooting topic Armflang segfaults at -Ofast optimization level.
-fno-stack-arrays