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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think it is just warning on dead code, but GCC doesn't know it is dead code.
s390 doesn't have any partial or vector modes, so expmed_mode_index
because MIN_MODE_PARTIAL_INT and MIN_MODE_VECTOR_INT are 0 becomes:
  switch (((enum mode_class) mode_class[mode]))
    {
    case MODE_INT:
      return mode - 22;
    case MODE_PARTIAL_INT:
      return mode + 6;
    case MODE_VECTOR_INT:
      return mode + 6;
    default:
      gcc_unreachable ();
    }
}

Now, when we use the result of this in a loop with mode going from 22 to 27 or
so, for MODE_INT (which those modes are) we get correct values 0 to 5, but for
for the other cases the range of mode + 6 will be 28 to 33 which obviously
doesn't fit as a valid index into array of 6.  Now, when jump threading or what
duplicates the array accesses for the different cases, it is obvious why VRP2
complains.  But, I'd guestion the desirability to warn about it during VRP2 at
all, at least unless we have some way to mark statements that were jump
threaded and just not warn about those.  I remember various other issues like
this in the past.

Reply via email to