aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/c-c++-common/pr98556.c11
-rw-r--r--gcc/tree-cfg.c2
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/testsuite/c-c++-common/pr98556.c b/gcc/testsuite/c-c++-common/pr98556.c
new file mode 100644
index 0000000..865957b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr98556.c
@@ -0,0 +1,11 @@
+/* PR c++/98556 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+enum T { E = -__LONG_MAX__ - 1 };
+
+enum T
+foo (char *p, char *q)
+{
+ return (enum T) (p - q);
+}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index cea7f92..75d814b 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3940,7 +3940,7 @@ verify_gimple_assign_binary (gassign *stmt)
/* 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
+ || !INTEGRAL_TYPE_P (lhs_type)
|| TYPE_UNSIGNED (lhs_type)
|| TYPE_PRECISION (lhs_type) != TYPE_PRECISION (rhs1_type))
{