This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/30398] New: memmove for string operations
- From: "tkoenig at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jan 2007 22:05:44 -0000
- Subject: [Bug fortran/30398] New: memmove for string operations
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The compiler should be able to detect that s and c
are not aliased, so a call to memcpy instead of memmove
could be issued.
$ cat memmove.f90
program main
character(len=1) :: s
character(len=2) :: c
s = 'a'
c = repeat(s,2)
end program main
$ gfortran -fdump-tree-original memmove.f90
$ cat memmove.f90.003t.original
MAIN__ ()
{
char c[1:2];
char s[1:1];
_gfortran_set_std (70, 127, 0);
s[1]{lb: 1 sz: 1} = "a"[1]{lb: 1 sz: 1};
{
char str.0[2];
_gfortran_string_repeat ((char[1:] *) &str.0, 1, &s, 2);
__builtin_memmove (&c, (char[1:] *) &str.0, 2);
}
}
--
Summary: memmove for string operations
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tkoenig at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30398