]> gcc.gnu.org Git - gcc.git/commitdiff
genrecog.c (validate_pattern): For VEC_SELECT verify that CONST_INT selectors are...
authorJakub Jelinek <jakub@redhat.com>
Thu, 12 Oct 2017 12:11:11 +0000 (14:11 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 12 Oct 2017 12:11:11 +0000 (14:11 +0200)
* genrecog.c (validate_pattern): For VEC_SELECT verify that
CONST_INT selectors are 0 to GET_MODE_NUNITS (imode) - 1.

From-SVN: r253676

gcc/ChangeLog
gcc/genrecog.c

index f632f6ba1cf06143aa3f4b0020b1970d3b6af18d..a7468efa7486c5f002d7b2ccbe11f09de508b288 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-12  Jakub Jelinek  <jakub@redhat.com>
+
+       * genrecog.c (validate_pattern): For VEC_SELECT verify that
+       CONST_INT selectors are 0 to GET_MODE_NUNITS (imode) - 1.
+
 2017-10-12  Aldy Hernandez  <aldyh@redhat.com>
 
        * Makefile.in (TAGS): Merge all the *.def files into one pattern.
index 902762fbc57379c598e1068a7a6d0b060723cb11..b3d02d755ebb476df09fe9cbedfe424bb6b317f5 100644 (file)
@@ -751,6 +751,21 @@ validate_pattern (rtx pattern, md_rtx_info *info, rtx set, int set_code)
                error_at (info->loc,
                          "vec_select parallel with %d elements, expected %d",
                          XVECLEN (XEXP (pattern, 1), 0), expected);
+             else if (VECTOR_MODE_P (imode))
+               {
+                 unsigned int nelems = GET_MODE_NUNITS (imode);
+                 int i;
+                 for (i = 0; i < expected; ++i)
+                   if (CONST_INT_P (XVECEXP (XEXP (pattern, 1), 0, i))
+                       && (UINTVAL (XVECEXP (XEXP (pattern, 1), 0, i))
+                           >= nelems))
+                     error_at (info->loc,
+                               "out of bounds selector %u in vec_select, "
+                               "expected at most %u",
+                               (unsigned)
+                               UINTVAL (XVECEXP (XEXP (pattern, 1), 0, i)),
+                               nelems - 1);
+               }
            }
          if (imode != VOIDmode && !VECTOR_MODE_P (imode))
            error_at (info->loc, "%smode of first vec_select operand is not a "
This page took 0.079077 seconds and 5 git commands to generate.