diff mbox

[lower-subreg] Fix 70355

Message ID 56F9EF32.6040303@redhat.com
State New
Headers show

Commit Message

Richard Henderson March 29, 2016, 2:57 a.m. UTC
The ICE comes fixing up a debug_insn, and the debug info incoming to the pass 
seems reasonable.  Just recognizing that this situation is possible and not 
asserting appears to work.

Ok?


r~
* lower-subreg.c (simplify_subreg_concatn): Reject paradoxical subregs.

Comments

Jakub Jelinek March 29, 2016, 6:22 a.m. UTC | #1
On Mon, Mar 28, 2016 at 07:57:54PM -0700, Richard Henderson wrote:
> The ICE comes fixing up a debug_insn, and the debug info incoming to the
> pass seems reasonable.  Just recognizing that this situation is possible and
> not asserting appears to work.
> 
> Ok?
> 
> 
> r~

> 	* lower-subreg.c (simplify_subreg_concatn): Reject paradoxical subregs.

Ok, thanks.

	Jakub
diff mbox

Patch

diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 5432d05..f7b3ac4 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -614,7 +614,8 @@  simplify_subreg_concatn (machine_mode outermode, rtx op,
 
   innermode = GET_MODE (op);
   gcc_assert (byte < GET_MODE_SIZE (innermode));
-  gcc_assert (GET_MODE_SIZE (outermode) <= GET_MODE_SIZE (innermode));
+  if (GET_MODE_SIZE (outermode) > GET_MODE_SIZE (innermode))
+    return NULL_RTX;
 
   inner_size = GET_MODE_SIZE (innermode) / XVECLEN (op, 0);
   part = XVECEXP (op, 0, byte / inner_size);
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr70355.c b/gcc/testsuite/gcc.c-torture/compile/pr70355.c
new file mode 100644
index 0000000..4749427
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr70355.c
@@ -0,0 +1,14 @@ 
+/* { dg-require-effective-target int128 } */
+/* { dg-additional-options "-g" } */
+
+typedef unsigned __int128 v2ti __attribute__ ((vector_size (32)));
+
+unsigned
+foo (unsigned i, v2ti v)
+{
+  do {
+    i--;
+    v %= ~v;
+  } while (i);
+  return v[0] + v[1];
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr70355.c b/gcc/testsuite/gcc.target/i386/pr70355.c
new file mode 100644
index 0000000..b55f6fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr70355.c
@@ -0,0 +1,14 @@ 
+/* { dg-require-effective-target int128 } */
+/* { dg-options "-O2 -fno-tree-ter -funroll-loops -mavx512f -g" } */
+
+typedef unsigned __int128 v2ti __attribute__ ((vector_size (32)));
+
+unsigned
+foo (unsigned i, v2ti v)
+{
+  do {
+    i--;
+    v %= ~v;
+  } while (i);
+  return v[0] + v[1];
+}