[PATCH] D45510: [RFC][AliasAnalysis][BasicAA] Return MayAlias for the pointer plus variable offset to structure object member

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 12 18:24:56 PDT 2018


On Thu, Apr 12, 2018 at 5:23 PM, Shiva Chen via Phabricator <
reviews at reviews.llvm.org> wrote:

> shiva0217 added a comment.
>
> In https://reviews.llvm.org/D45510#1066136, @dberlin wrote:
>
> > This C case is actually not legal (it's been discussed before many
> times).
> >  You cannot take the address of .a field, add an offset, and get to
> another field legally.
> >  So i wouldn't express it in these terms, since in that language, this
> is clearly illegal.
> >
> > The LLVM version, of course, does not make this undefined behavior AFAIK
> (which is a source of much imprecision)
>
>
> Hi @dberlin. Thanks for the comments. So it's a language restriction which
> is illegal! Would you mind point me out which rule in C99 mention this
> restriction or the threads relative to this topic we could follow?
>

It's covered extensively gcc bugzilla (searches for struct and aliasing
will find various bugs and lead you back to various discussions), cerebus,
and elsewhere.

I don't have trivial links for you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180412/274f16fb/attachment.html>


More information about the llvm-commits mailing list