re PR tree-optimization/85331 (during GIMPLE pass, internal compiler error: Segmentat...
authorJakub Jelinek <jakub@redhat.com>
Wed, 11 Apr 2018 13:35:13 +0000 (15:35 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 11 Apr 2018 13:35:13 +0000 (15:35 +0200)
PR tree-optimization/85331
* vec-perm-indices.h (vec_perm_indices::clamp): Change input type
from int to HOST_WIDE_INT.

* gcc.c-torture/execute/pr85331.c: New test.

From-SVN: r259320

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr85331.c [new file with mode: 0644]
gcc/vec-perm-indices.h

index 7964b384d0b2422154788eab086ade778e132724..96c7c2874aead9380b18273557a567e30903d5cd 100644 (file)
@@ -1,3 +1,9 @@
+2018-04-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/85331
+       * vec-perm-indices.h (vec_perm_indices::clamp): Change input type
+       from int to HOST_WIDE_INT.
+
 2018-04-11  Martin Jambor  <mjambor@suse.cz>
 
        PR ipa/84149
index 186986aafe4f231c21dae3b958d277aad794950d..b473add86db294dfed9512cc75b8d15bb2fa1d5e 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/85331
+       * gcc.c-torture/execute/pr85331.c: New test.
+
 2018-04-11  Marek Polacek  <polacek@redhat.com>
 
        PR c++/85032
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr85331.c b/gcc/testsuite/gcc.c-torture/execute/pr85331.c
new file mode 100644 (file)
index 0000000..3ef805a
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR tree-optimization/85331 */
+
+typedef double V __attribute__((vector_size (2 * sizeof (double))));
+typedef long long W __attribute__((vector_size (2 * sizeof (long long))));
+
+__attribute__((noipa)) void
+foo (V *r)
+{
+  V y = { 1.0, 2.0 };
+  W m = { 10000000001LL, 0LL };
+  *r = __builtin_shuffle (y, m);
+}
+
+int
+main ()
+{
+  V r;
+  foo (&r);
+  if (r[0] != 2.0 || r[1] != 1.0)
+    __builtin_abort ();
+  return 0;
+}
index 429a4e86054ecd998e148f869bc0d8533892315e..d805fbb8f761e17a28bf41f5a19db6970fece94e 100644 (file)
@@ -119,7 +119,7 @@ inline vec_perm_indices::element_type
 vec_perm_indices::clamp (element_type elt) const
 {
   element_type limit = input_nelts (), elem_within_input;
-  int input;
+  HOST_WIDE_INT input;
   if (!can_div_trunc_p (elt, limit, &input, &elem_within_input))
     return elt;