3.1 TMPDIR—Directory for scratch files
When opening a file with STATUS='SCRATCH', GNU Fortran tries to create the file in one of the potential directories by testing each directory in the order below. 
-  The environment variable 
TMPDIR, if it exists. -  On the MinGW target, the directory returned by the 
GetTempPathfunction. Alternatively, on the Cygwin target, theTMPandTEMPenvironment variables, if they exist, in that order. -  The 
P_tmpdirmacro if it is defined, otherwise the directory /tmp. 
    © Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
    https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gfortran/TMPDIR.html