I realized I didn't make the necessary edits for gfortran.
gcc/fortran/ChangeLog ----- 2016-03-21 Daniel Sabogal <dsabo...@ufl.edu> PR preprocessor/51259 * cpp.c (print_line): Allow replacement when calling "cpp_quote_string". (pp_dir_change): Allow replacement when calling "cpp_quote_string". Patch ----- Index: gcc/fortran/cpp.c =================================================================== --- gcc/fortran/cpp.c (revision 234355) +++ gcc/fortran/cpp.c (working copy) @@ -843,7 +843,7 @@ /* cpp_quote_string does not nul-terminate, so we have to do it ourselves. */ p = cpp_quote_string (to_file_quoted, - (const unsigned char *) loc.file, to_file_len); + (const unsigned char *) loc.file, to_file_len, true); *p = '\0'; fprintf (print.outf, "# %u \"%s\"%s", print.src_line == 0 ? 1 : print.src_line, @@ -1080,7 +1080,7 @@ unsigned char *p; /* cpp_quote_string does not nul-terminate, so we have to do it ourselves. */ - p = cpp_quote_string (to_file_quoted, (const unsigned char *) dir, to_file_len); + p = cpp_quote_string (to_file_quoted, (const unsigned char *) dir, to_file_len, true); *p = '\0'; fprintf (print.outf, "# 1 \"%s//\"\n", to_file_quoted); }