[Bug c++/45752] New: [4.5 regression] ICE in ix86_vectorize_builtin_vec_perm_ok

2010-09-22 Thread y at momonga-linux dot org
g++ 4.5-20100916 ICEs with "-O3 -march=pentium4" when using the following code:


template
void transform(const T *in_points,
   int num_points,
   const float projection_mat[16],
   const float modelview_mat[16],
   float *out_points)
{
  float mat[16];
  int row, col;
  int i;
  const T *in_p;
  float *out_p;

  for (col = 0; col < 4; col++)
{
  for (row = 0; row < 4; row++)
{
  mat[col*4+row] = ( projection_mat[0*4+row]*modelview_mat[col*4+0]
 + projection_mat[1*4+row]*modelview_mat[col*4+1]
 + projection_mat[2*4+row]*modelview_mat[col*4+2]
 + projection_mat[3*4+row]*modelview_mat[col*4+3]);
}
}

  for (i = 0, in_p = in_points, out_p = out_points; i < num_points;
   i++, in_p += 3, out_p += 3)
{
  for (row = 0; row < 3; row++)
{
  out_p[row] = ( mat[0*4+row]*in_p[0] + mat[1*4+row]*in_p[1]
 + mat[2*4+row]*in_p[2] + mat[3*4+row]);
}
}

  if ( (mat[0*4+3] != 0) || (mat[1*4+3] != 0)
   || (mat[0*4+3] != 0) || (mat[1*4+3] != 1) )
{
  for (i = 0, in_p = in_points, out_p = out_points; i < num_points;
   i++, in_p += 3, out_p += 3)
{
  float w = ( mat[0*4+3]*in_p[0] + mat[1*4+3]*in_p[1]
  + mat[2*4+3]*in_p[2] + mat[3*4+3]);
  if (w > 0.0)
{
  out_p[0] /= w;
  out_p[1] /= w;
  out_p[2] /= w;
}
  else
{
  out_p[2] = -static_cast< float >(1.0e+38f);
}
}
}
}
void TransformPoints(double *input,
 int num_input,
 const float projection_mat[16],
 const float modelview_mat[16],
 float *output)
{
  transform(input, num_input, projection_mat, modelview_mat, 
output);
}

void TransformPoints(unsigned short *input,
 int num_input,
 const float projection_mat[16],
 const float modelview_mat[16],
 float *output)
{
  transform(input, num_input, projection_mat, modelview_mat, 
output);
}


-- 
   Summary: [4.5 regression] ICE in
ix86_vectorize_builtin_vec_perm_ok
   Product: gcc
   Version: 4.5.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: y at momonga-linux dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45752



[Bug c/36245] New: internal compiler error: in build2_stat, at tree.c:3116

2008-05-15 Thread y at momonga-linux dot org
The following code produces an ICE with -O1 or -O2

$ cat foo.c
extern char buf1[10];
extern char buf2[10];
extern void b(int i, int j, int w);

void a() {
int i,j;
char *p;
int w;

p = buf1;
for(j = 0;j < 10; j++) {
for(i = 0;i < 10; i++) {
w = *p;
if(w != 1) {
w = buf2[p - buf1];
b(i*2+1, j, w);
}
p++;
}
}
}

$ gcc -O1 foo.c
foo.c: In function 'a':
foo.c:5: internal compiler error: in build2_stat, at tree.c:3116
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.


-- 
   Summary: internal compiler error: in build2_stat, at tree.c:3116
   Product: gcc
   Version: 4.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: y at momonga-linux dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36245