This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/54132] New: Incorrect loop transformation with -ftree-loop-distribute-patterns
- From: "mans at mansr dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 30 Jul 2012 22:28:34 +0000
- Subject: [Bug tree-optimization/54132] New: Incorrect loop transformation with -ftree-loop-distribute-patterns
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54132
Bug #: 54132
Summary: Incorrect loop transformation with
-ftree-loop-distribute-patterns
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mans@mansr.com
The following function is incorrectly optimised when
-ftree-loop-distribute-patterns is used (enabled by -O3):
void foo(char *p, int n)
{
int i;
for (i = 0; i < n; i++)
p[i] = p[i - 1];
}
The loop is replaced by a call to memmove(), whereas the correct operation is
equivalent to memset(p, p[-1], n).