+ /* A structure that has more than PTRDIFF_MAX bytes is unfortunately
+ * legal in C, but in such, if two elements are far enough apart, we
+ * can't legally find out how far apart they are. Limit the size of a
+ * malloc so that pointer subtraction in the same structure is always
+ * well defined */
+ if (nbytes > PTRDIFF_MAX) {
+ dTHX;
+ MYMALLOC_WRITE2STDERR("Memory requests are limited to PTRDIFF_MAX"
+ " bytes to prevent possible undefined"
+ " behavior");
+ return NULL;
+ }
+