This small test program generates a segfault if it is compiled with:
gcc40 -march=opteron -O2 -ftree-vectorize gccbug.cpp -o gccbug
Segfault does not occur when __attribute__((noinline)) is omitted.
It occurs with snapshot 20050213 and snapshot 20050220,
but not with snapshot 20050130
Michael Cieslinski
==========================
#include <emmintrin.h>
static struct KStructType
{union{
short Kernshort[8][24];
__m128i KernSSE[8][3];
};} KU __attribute__(( aligned(16) ));
static void VecBug(short Kernel[8][24]) __attribute__((noinline));
static void VecBug(short Kernel[8][24])
{
for (int k = 0; k<8; k++)
for (int i = 0; i<24; i++)
KU.Kernshort[k][i] = Kernel[k][i];
}
int main (int argc, char **argv)
{
short Kernel[8][24];
for (int k = 0; k<8; k++)
for (int i = 0; i<24; i++)
Kernel[k][i] = 0;
VecBug(Kernel);
return 0;
}
--
Summary: Wrong code with gcc 4.0 tree-vectorizer
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: micis at gmx dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20122