[LLVMdev] AA bug?

Eli Friedman eli.friedman at gmail.com
Wed Jul 20 21:25:59 PDT 2011


On Wed, Jul 20, 2011 at 8:18 PM, Vikram Adve <vadve at illinois.edu> wrote:
> I was reading the code in AliasAnalysis.cpp and happened to notice what looks like a bug. See the line marked by '*' below:
>
> AliasAnalysis::ModRefResult
> AliasAnalysis::getModRefInfo(const VAArgInst *V, const Location &Loc) {
>  // If the va_arg address cannot alias the pointer in question, then the
>  // specified memory cannot be accessed by the va_arg.
>  if (!alias(getLocation(V), Loc))
>    return NoModRef;
>
>  // If the pointer is a pointer to constant memory, then it could not have been
>  // modified by this va_arg.
>  if (pointsToConstantMemory(Loc))
>    return NoModRef;                *************
>
>  // Otherwise, a va_arg reads and writes.
>  return ModRef;
> }
>
>
> ************* It looks like that line should be
>    return Ref;
>
> I don't have a test case to reproduce this since I was just reading.

If pointsToConstantMemory(Loc), a va_arg touching Loc would be
undefined because va_arg writes to its argument.  So I think the AA
implementation is right as-is.

-Eli




More information about the llvm-dev mailing list