From 79896068bb3947f11583f5a1dfd30fc0569f91c8 Mon Sep 17 00:00:00 2001 From: jakub Date: Thu, 7 Dec 2017 17:06:08 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255470 138bc75d-0d04-0410-961f-82ee72b054a4 --- 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.11.4.GIT