Under some conditions, use of an implied loop in a WRITE statement causes a C0000005 internal compiler error, with no other information provided. This is for the 18.104.22.168 [IA-32] Visual Fortran compiler. This problem does not occur with the 11.1 version of the compiler. If you are unaware of this problem, let me know and I will send an example.
Attached are two files, a minimal subroutine that demonstrates the problem (with two effective work-arounds commented out) and the build log that actually shows the error. The module containing the subroutine has been inserted into a project to allow compilation, but is not called, nor is the module USEd in any other subroutines of the project.
FORTRAN command line is:
/nologo /debug:full /Od /extend_source:132 /warn:truncated_source /warn:interfaces /real_size:64 /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc120.pdb" /list:"Debug\COGNIT_N.lst" /traceback /check:bounds /libs:static /threads /dbglibs /c
Please provide the sources for building the modules 'FILES' and 'UTILS' that are USEd in your subroutine. Without those, the compiler aborts when it sees the USE lines in PRN_EXP.for.
Thank you for the convenient reproducer. The internal error occurs related to compiling with Check Bounds enabled (/check:bounds). You could avoid the source code change work around by temporarily disabling bounds checking (under the IDE properties: Fortran > Run-time > Check Array and String Bounds). You can disable this option on a per source file basis if you wish to keep it enabled for other source files.
I reported the issue to Development.
(Internal tracking id: DPD200419792)