The following fixes a checking issue when verifying BIT_FIELD_REF
sizes of non-integral non-BLKmode types.  We should be using
MODE_SIZE, not MODE_PRECISION here as seen with the testcase.

Bootstrap / regtest running on x86_64-unknown-linux-gnu.

typedef long double a __attribute__((vector_size (32)));

still explodes in our face - I suppose backends need to have
a lever to what we allow as component types here (after all
they define the ABI for this kind of stuff - or fail to ;))

Richard.

2016-03-01  Richard Biener  <rguent...@suse.de>

        PR middle-end/67278
        * tree-cfg.c (verify_expr): Adjust BIT_FIELD_REF case.

        * gcc.dg/simd-7.c: New testcase.

Index: gcc/tree-cfg.c
===================================================================
--- gcc/tree-cfg.c      (revision 233852)
+++ gcc/tree-cfg.c      (working copy)
@@ -2959,10 +2959,10 @@ verify_expr (tree *tp, int *walk_subtree
            }
          else if (!INTEGRAL_TYPE_P (TREE_TYPE (t))
                   && TYPE_MODE (TREE_TYPE (t)) != BLKmode
-                  && (GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (t)))
+                  && (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (t)))
                       != tree_to_uhwi (t1)))
            {
-             error ("mode precision of non-integral result does not "
+             error ("mode size of non-integral result does not "
                     "match field size of BIT_FIELD_REF");
              return t;
            }
Index: gcc/testsuite/gcc.dg/simd-7.c
===================================================================
--- gcc/testsuite/gcc.dg/simd-7.c       (revision 0)
+++ gcc/testsuite/gcc.dg/simd-7.c       (working copy)
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#if __SIZEOF_LONG_DOUBLE__ == 16 || __SIZEOF_LONG_DOUBLE__ == 8
+typedef long double a __attribute__((vector_size (16)));
+
+a __attribute__((noinline))
+sum (a first, a second)
+{
+    return first + second;
+}
+
+a
+foo (a x, a y, a z)
+{
+  return sum (x, y) + z;
+}
+#endif

Reply via email to