https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101162
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I was just about to assign this to myself as I had just came up with a fix:
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 85e90f42b8e..5e4bdeace1e 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -5361,7 +5361,7 @@ range_check_type (tree etype)
else
return NULL_TREE;
}
- else if (POINTER_TYPE_P (etype))
+ else if (POINTER_TYPE_P (etype) || TREE_CODE (etype) == OFFSET_TYPE)
etype = unsigned_type_for (etype);
return etype;
}