http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54894
Bug #: 54894 Summary: internal compiler error: in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1286 Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: kuszm...@gmail.com Created attachment 28415 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28415 preprocessed code for matrix multiply I'm having trouble getting gcc to remember alignment information the attached matrix multiplication code. So I introduced a temporary variable that is a pointer to a 16-byte aligned double, and ended up with this error: $ gcc -O3 -std=c99 mm_tile.c -Wcast-align -o mm_tile mm_tile.c: In function ‘main’: mm_tile.c:46:5: internal compiler error: in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1286 Please submit a full bug report, with preprocessed source if appropriate. See <http://bugzilla.redhat.com/bugzilla> for instructions. Preprocessed source stored into /tmp/ccvYpDPi.out file, please attach this to your bugreport. $ gcc --version gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2) Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ cat mm_tile.c /** BEGIN HIDDEN **/ #include <stdlib.h> #include <stdio.h> #include <sys/time.h> typedef unsigned long long uint64_t; /* Allow us to change n on the compiler command line with for example -Dn=1024 */ #ifndef n #define n 4096 #endif double A[n][n] __attribute__((aligned(16))); double B[n][n] __attribute__((aligned(16))); double C[n][n] __attribute__((aligned(16))); static float tdiff (struct timeval *start, struct timeval *end) { return (end->tv_sec-start->tv_sec) +1e-6*(end->tv_usec-start->tv_usec); } #include "verify.h" #define tilesize 128 /* void mmbase (double *restrict C, double *restrict A, double *restrict B) { */ /* for (int kh = 0; kh < n; kh += tilesize) { */ /* for (int il = 0; il < tilesize; il++) { */ /* for (int kl = 0; kl < tilesize; ++kl) { */ /* for (int jl = 0; jl < tilesize; jl++) { */ /* C[il*n+jl] += A[il*n+kh+kl]*B[(kh+kl)*n+jl]; */ /* } */ /* } */ /* } */ /* } */ /* } */ /* void mm_js(double *restrict C, double *restrict A, double *restrict B) { */ /* for (int jh = 0; jh < n; jh += tilesize) { */ /* mmbase(&C[jh], &A[0], &B[jh]); */ /* } */ /* } */ typedef double adouble __attribute__((__aligned__(16))); int main(int argc, const char *argv[]) { parse_args(argc, argv); for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { A[i][j] = (double)rand() / (double)RAND_MAX; B[i][j] = (double)rand() / (double)RAND_MAX; C[i][j] = 0; } } struct timeval start, end; gettimeofday(&start, NULL); /** END HIDDEN **/ for (int ih = 0; ih < n; ih += tilesize) { ///\lilabel{block_loop_i} for (int jh = 0; jh < n; jh += tilesize) { ///\lilabel{block_loop_k} for (int kh = 0; kh < n; kh += tilesize) { ///\lilabel{block_loop_j} for (int il = 0; il < tilesize; ++il) { ///\lilabel{base_loop_i} adouble *Ap = (adouble *)&A[ih+il][kh]; for (int kl = 0; kl < tilesize; ++kl) { ///\lilabel{base_loop_k} for (int jl = 0; jl < tilesize; ++jl) { ///\lilabel{base_loop_j} C[ih+il][jh+jl] += Ap[kl] * B[kh+kl][jh+jl]; ///\lilabel{base_multiply} } } } } /* mmbase(&C[ih][jh],&A[ih][0],&B[0][jh]); */ } /* mm_js(&C[ih][0], &A[ih][0], &B[0][0]); */ } /** BEGIN HIDDEN **/ gettimeofday(&end, NULL); printf("%0.6f\n", tdiff(&start, &end)); if (need_to_verify) verify(); return 0; } /** END HIDDEN **/