[Bug middle-end/56934] New: ICE folding a COND_EXPR involving vectors

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Apr 12 13:50:00 GMT 2013


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

             Bug #: 56934
           Summary: ICE folding a COND_EXPR involving vectors
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: glisse@gcc.gnu.org


typedef long veci __attribute__((vector_size(16)));
veci f(double a, veci b){
  return (a<2)?(b<3):(b!=b);
}

e.cc: In function 'veci f(double, veci)':
e.cc:3:27: internal compiler error: in fold_convert_loc, at fold-const.c:1972
   return (a<2)?(b<3):(b!=b);
                           ^

I think the folding should just be disabled in this case. Even if fold_convert
was taught how to convert scalars to vectors, it would produce a vector {1,1}
instead of {-1,-1} (and it would build a TRUTH_ANDIF_EXPR with vectors). I have
a fix as part of another patch.

An alternative fix would be to make truth_value_p return false for vectors,
which would make us regress on several optimizations I guess.



More information about the Gcc-bugs mailing list