Same problem occurs in 4.0.1, 4.1 (Subversion) but not in 4.2 (Subversion).
$ gcc -c -ftree-vectorize -O2 oct_makes_gcc_explode.i
oct_makes_gcc_explode.i: In function slow_close:
oct_makes_gcc_explode.i:8: internal compiler error: in gimplify_expr, at
gimplify.c:4182
$ cat oct_makes_gcc_explode.i
typedef double num_t;
typedef long size_t;
void *octfag_mm_malloc (size_t t);
void octfag_mm_free (void* p);
void
slow_close(num_t* m, int n)
{
int i,j,k;
num_t* mm = ((num_t*) octfag_mm_malloc (sizeof(num_t)*(4*n*n)));
num_t a,b,c,d;
;
; ; ; ;
for (k=0;k<2*n;k+=2) {
for (i=0;i<2*n;i++)
for (j=0;j<2*n;j++) {
*(&a) = *(m+i*2*n+k) + *(m+k*2*n+j);
*(&b) = *(m+i*2*n+k+1) + *(m+(k+1)*2*n+j);
*(&c) = *(m+i*2*n+k) + *(m+k*2*n+k+1); *(&c) = *(&c) + *(m+(k+1)*2*n+j);
*(&d) = *(m+i*2*n+k+1) + *(m+(k+1)*2*n+k); *(&d) = *(&d) + *(m+k*2*n+j);
num_min(&a,&a,&b);
num_min(&c,&c,&d);
num_min(&a,&a,&c);
num_min(mm+i*2*n+j,mm+i*2*n+j,&a);
}
for (i=0;i<2*n;i++) *(mm+i*2*n+i) = (num_t)(0);
for (i=0;i<2*n;i++)
for (j=0;j<2*n;j++) {
*(&a) = *(mm+i*2*n+(i^1)) / 2.;
*(&b) = *(mm+(j^1)*2*n+j) / 2.;
*(&a) = *(&a) + *(&b);
num_min(mm+i*2*n+j,mm+i*2*n+j,&a);
}
}
;
; ; ; ;
octfag_mm_free(mm);
}
--
Summary: -ftree-vectorize results in internal compiler error on
AMD64
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: David dot Monniaux at ens dot fr
GCC build triplet: x86_64-redhat-linux
GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25371