[llvm-dev] UBSan, StringRef and Allocator.h

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 22 18:05:27 PDT 2016


On Tue, Mar 22, 2016 at 6:00 PM, Pete Cooper <peter_cooper at apple.com> wrote:
> That was an assumption on my part that “allocate(0) != allocate(0)’.  That
> is, I didn’t think you needed to dereference a pointer for no alias, just
> compare it.  I could be wrong as I’m just assuming thats the behavior
> without any formal knowledge on the subject.

I was quoting from AliasAnalysis.h:

// - NoAlias doesn't imply inequal pointers. The most obvious example of this
// is two pointers to constant memory. Even if they are equal, constant
// memory is never stored to, so there will never be any dependencies.
// In this and other situations, the pointers may be both NoAlias and
// MustAlias at the same time. The current API can only return one result,
// though this is rarely a problem in practice.


but there is the caveat that the C++ level noalias annotation may be different
from LLVM's NoAlias, something I'm not a 100% sure of.

-- Sanjoy


More information about the llvm-dev mailing list