This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/36008] [4.3/4.4 Regression] Function produces wrong results when inlined.
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Apr 2008 16:53:59 -0000
- Subject: [Bug rtl-optimization/36008] [4.3/4.4 Regression] Function produces wrong results when inlined.
- References: <bug-36008-16093@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #10 from jakub at gcc dot gnu dot org 2008-04-23 16:53 -------
And one with just one inlined fn:
extern void abort (void);
void __attribute__ ((noinline))
bar (int m[3][3], int a[3][3], int b[3][3])
{
int i, j;
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
m[i][j] = a[i][0] * b[0][j] + a[i][1] * b[1][j] + a[i][2] * b[2][j];
}
static inline void __attribute__ ((always_inline))
foo (int x[][3][3], int g[3][3], int y, int z)
{
int i, j, k;
for (i = 0; i < y; i++)
for (j = 0; j < z - 1; j++)
{
k = i * (z - 1) + j + y;
bar (x[k], g, x[k - y]);
}
}
int g[48][3][3] = {
{ {1, 0, 0}, {0, 1, 0}, {0, 0, 1} }, { {-1, 0, 0}, {0, -1, 0}, {0, 0, -1} },
{ {-1, 0, 0}, {0, 1, 0}, {0, 0, -1} }, { {1, 0, 0}, {0, -1, 0}, {0, 0, 1} },
{ {-1, 0, 0}, {0, -1, 0}, {0, 0, 1} }, { {1, 0, 0}, {0, 1, 0}, {0, 0, -1} },
{ {1, 0, 0}, {0, -1, 0}, { 0, 0, -1} }, { {-1, 0, 0}, {0, 1, 0}, {0, 0, 1} } };
int h[3][3] = { {0, 1, 0}, {1, 0, 0}, {0, 0, 1} };
int
main ()
{
foo (g, h, 8, 2);
if (g[1][1][0] != 0)
abort ();
return 0;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36008