This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/32223] Backslash handling inconsistent
- From: "dfranke at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Jun 2007 17:38:18 -0000
- Subject: [Bug fortran/32223] Backslash handling inconsistent
- References: <bug-32223-10129@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from dfranke at gcc dot gnu dot org 2007-06-05 17:38 -------
Some more information:
"Change the interpretation of backslashes in string literals from
“C-style” escape characters to a single backslash character. "
$> cat char.f90
character(len=1) :: c
DATA c / '\0' /
print *, c
end
$> gfortran-svn -fbackslash char.f90 && ./a.out
char.f90:2.9:
DATA c / '\0' /
1
Warning: initialization string truncated to match variable at (1)
\
$> gfortran-svn -fno-backslash char.f90 && ./a.out
char.f90:2.9:
DATA c / '\0' /
1
Warning: initialization string truncated to match variable at (1)
\
The same is true for assignments, but here, -Wall is needed to print a warning
message:
$> cat char.f90
character(len=1) :: c
c = '\0'
print *, c
end
$> gfortran-svn -fno-backslash char.f90 && ./a.out
\
$> gfortran-svn -fbackslash char.f90 && ./a.out
\
gfortran-svn -fbackslash -Wall char.f90 && ./a.out
char.f90:2.8:
c = '\0'
1
Warning: CHARACTER expression will be truncated in assignment (1/2) at (1)
For the latter example the dump shows:
__builtin_memmove (&c, "\\0", 1);
regardless of -f[no-]backslash.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32223