Currently, \ are treated by default as C-style escape characters with some special treatment to allow foo = "\"
At least for Windows paths, the result of path = 'c:\windows\somewhere\big.txt' is surprising as the \w remains but the \b is replaced. I believe one should give a warning that \w does not match anything. Additionally, we should consider to default to -fbackslash - at least on Windows. Note additionally that "\" belongs to Fortran 2003 standard Fortran character set. Currently we offer: -fno-backslash Change the interpretation of backslashes in string literals from "C-style" escape characters to a single backslash character. >From the thread at http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/c8dd08d6da052499/ Remark by Richard Maine: Well, in f0003, backslash is part of the standard Fortran character set. So I'll find it awfully hard to accept as reasonable a default that doesn't conform to the standard. But then I'm one of those who has always thought that doing backslash processing on Fortan code was an unreasonable default, so just consider me biased. Remark by James Van Buskirk: Andy was kind enough to change the default to -fno-backslash for Windows g95, following the logic that it's quite common to want to specify paths with embedded backslashes on that platform. The C escape sequences are mostly just an annoyance to be worked around for Fortran programmers. As a C programmer writing a Fortran compiler it may not always be apparent how confusing and error-prone the C way of doing things is (to a Fortran programmer) but it is as bad as that and worse. Same goes for internal representations of LOGICAL variables. -- Summary: Treat \ as normal character (at least on Windows); diagnose unrecognized escape characters Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: diagnostic Severity: enhancement Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34203