[llvm-dev] Clang 5, UBsan, runtime error: addition of unsigned offset to X overflowed to Y

Jeffrey Walton via llvm-dev llvm-dev at lists.llvm.org
Sat Dec 16 15:14:31 PST 2017


On Sat, Dec 16, 2017 at 4:53 PM, Sean Silva <chisophugis at gmail.com> wrote:
> It looks like the complaint is about overflow of the pointer itself, which
> makes sense since you are adding a very large unsigned number to it. Maybe
> use ptrdiff_t for inc?

Thanks Sean.

It took a few tries, but that cleared it. All of the size_t's that
were being added to the pointer had to be swapped-out for ptrdiff_t's.

Jeff


More information about the llvm-dev mailing list