re PR middle-end/83164 (internal compiler error: verify_gimple failed)
authorJakub Jelinek <jakub@redhat.com>
Thu, 7 Dec 2017 17:06:08 +0000 (18:06 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 7 Dec 2017 17:06:08 +0000 (18:06 +0100)
PR middle-end/83164
* tree-cfg.c (verify_gimple_assign_binary): Don't require
types_compatible_p, just that TYPE_MODE is the same.

* gcc.c-torture/compile/pr83164.c: New test.

From-SVN: r255470

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr83164.c [new file with mode: 0644]
gcc/tree-cfg.c

index f81665f650f93b93c864b9a0fcef66d2d1505d86..966810f15d562625915d7a5c6796cc8c985ca8b4 100644 (file)
@@ -1,3 +1,9 @@
+2017-12-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/83164
+       * tree-cfg.c (verify_gimple_assign_binary): Don't require
+       types_compatible_p, just that TYPE_MODE is the same.
+
 2017-12-07  Martin Sebor  <msebor@redhat.com>
 
        PR c/81544
index 4a4406a340594cd1719b9d87fb019ac8e94a7d4e..199cc283185f7a4ac639c7fdbf4368aff4621f78 100644 (file)
@@ -1,3 +1,8 @@
+2017-12-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/83164
+       * gcc.c-torture/compile/pr83164.c: New test.
+
 2017-12-07  Martin Sebor  <msebor@redhat.com>
 
        PR c/81544
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr83164.c b/gcc/testsuite/gcc.c-torture/compile/pr83164.c
new file mode 100644 (file)
index 0000000..e153e3b
--- /dev/null
@@ -0,0 +1,7 @@
+/* PR middle-end/83164 */
+
+__PTRDIFF_TYPE__
+foo (void)
+{
+  return (char *) foo - (char *) 0x1230;
+}
index e313df904433d3552630bea3d6ff5d3f5bfc2334..4d09b2cc99d7a0c0f14b05ddeed958fbbae5079f 100644 (file)
@@ -4007,7 +4007,9 @@ verify_gimple_assign_binary (gassign *stmt)
       {
        if (!POINTER_TYPE_P (rhs1_type)
            || !POINTER_TYPE_P (rhs2_type)
-           || !types_compatible_p (rhs1_type, rhs2_type)
+           /* Because we special-case pointers to void we allow difference
+              of arbitrary pointers with the same mode.  */
+           || TYPE_MODE (rhs1_type) != TYPE_MODE (rhs2_type)
            || TREE_CODE (lhs_type) != INTEGER_TYPE
            || TYPE_UNSIGNED (lhs_type)
            || TYPE_PRECISION (lhs_type) != TYPE_PRECISION (rhs1_type))