On 08/17/2017 04:40 AM, Kamil Dudka wrote: > -typedef short int DELTA; /* to hold displacement within one context */ > +typedef int DELTA; /* to hold displacement within one context */ Thanks for the heads-up. Although that fixes things for that particular test case, it won't work for larger cases. The type should be ptrdiff_t instead of int. As its FIXME comment says, ptx is riddled with integer-overflow bugs. I installed the attached patch to fix the bug that you mentioned along with the other low-hanging fruit that I found, and am marking the bug as fixed upstream. I expect some other integer-overflow bugs can still occur in practice, but at least this patch is a significant improvement. This patch prefers signed integer types like ptrdiff_t to unsigned types like size_t, as signed types allow for better checking when compiled with sanitization.