optimization/8634: [3.2/3.3 regression] incorrect code for inlining of memcpy under -O2
bangerth@dealii.org
bangerth@dealii.org
Wed Dec 4 14:31:00 GMT 2002
Old Synopsis: incorrect inlining of memcpy under -O2
New Synopsis: [3.2/3.3 regression] incorrect code for inlining of memcpy under -O2
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Wed Dec 4 14:31:57 2002
State-Changed-Why:
Confirmed. This program
----------------------------
#include <stdio.h>
#include <string.h>
int main()
{
char* buffer = new char[8];
const char head[8] = {
'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H'
};
memcpy(buffer,head,8);
for(int i=0;i<8;i++)
printf ("[%u] = %c, %c\n", i, head[i], buffer[i]);
return 0;
}
--------------------------------
yields with 3.2.2pre, 3.3pre, and 2.95 respectively:
tmp/g> /home/bangerth/bin/gcc-3.2.2-pre/bin/c++ -O2 bug.cc && ./a.out
[0] = A, A
[1] = B,
[2] = C,
[3] = D,
[4] = E, E
[5] = F, F
[6] = G, G
[7] = H, H
tmp/g> /home/bangerth/bin/gcc-3.3-pre/bin/c++ -O2 bug.cc && ./a.out
[0] = A, A
[1] = B,
[2] = C,
[3] = D,
[4] = E, E
[5] = F, F
[6] = G, G
[7] = H, H
tmp/g> c++ -O2 bug.cc && ./a.out
[0] = A, A
[1] = B, B
[2] = C, C
[3] = D, D
[4] = E, E
[5] = F, F
[6] = G, G
[7] = H, H
That seems like a regression.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8634
More information about the Gcc-bugs
mailing list