/* { dg-do compile } */
/* { dg-options "-O3 -g -ffast-math" } */

unsigned *d;
unsigned short e;
int f;
float h[3][4];

void
test (unsigned short *b)
{
  int a, c, i;
  float g[3];
  unsigned j[32] = { 10, 0x63707274 };
  for (i = 0; i < (int) j[0]; i++)
    {
      j[i * 3 + 2] = d[0];
      d[0] += (j[i * 3 + 3] + 3) & -4;
    }
  for (a = 0; a < e; a++)
    {
      g[0] = g[1] = g[2] = 0;
      for (c = 0; c < f; c++)
        {
          g[0] += h[0][c] * b[c];
          g[1] += h[1][c] * b[c];
        }
      for (c = 0; c < 3; c++)
        b[c] = 0 > ((int) g[c] < 65535 ? ((int) g[c]) : 65535) ? 0 : ((int)
g[c]) < 65535 ? (int) g[c] : 65535;
    }
}

ICEs with
internal compiler error: gimple check: expected gimple_phi(error_mark), have
gimple_debug() in gimple_phi_result_ptr, at gimple.h:3106
(and without checking just segfaults).
For i?86-linux ICEs/segfaults with additional -m32 -msse2.
The bug is (likely) in vect_create_epilog_for_reduction - phis vector contains
not just
g$1_145 = PHI <g$1_50(9)>
but also
# DEBUG g$1 => g$1_50
and for the latter obviously PHI_RESULT (exit_phi) is invalid.  Not sure if we
should completely ignore DEBUG_STMTs found in:
  phis = VEC_alloc (gimple, heap, 10);
  FOR_EACH_IMM_USE_FAST (use_p, imm_iter, scalar_dest)
    {
      if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))))
        {
          exit_phi = USE_STMT (use_p);
          VEC_quick_push (gimple, phis, exit_phi);
        }
    }
(not add them to the vector at all), or if we need to handle it specially.


-- 
           Summary: [4.5 Regression] VTA ICE in the vectorizer
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
GCC target triplet: x86_64-linux


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

Reply via email to