From 47f5f7e74920fe65f5ebe4737a9c70c34178990a Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 7 Dec 2017 18:06:08 +0100 Subject: [PATCH] re PR middle-end/83164 (internal compiler error: verify_gimple failed) 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 | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr83164.c | 7 +++++++ gcc/tree-cfg.c | 4 +++- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr83164.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f81665f650f..966810f15d5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-12-07 Jakub Jelinek + + 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 PR c/81544 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4a4406a3405..199cc283185 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-12-07 Jakub Jelinek + + PR middle-end/83164 + * gcc.c-torture/compile/pr83164.c: New test. + 2017-12-07 Martin Sebor 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 index 00000000000..e153e3b6fc0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr83164.c @@ -0,0 +1,7 @@ +/* PR middle-end/83164 */ + +__PTRDIFF_TYPE__ +foo (void) +{ + return (char *) foo - (char *) 0x1230; +} diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index e313df90443..4d09b2cc99d 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -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)) -- 2.30.2