[llvm-commits] [PATCH] bug 6028: fix interpreter assertion on use of undefined integer value

Nick Lewycky nlewycky at google.com
Thu Jan 14 13:42:50 PST 2010


On 14 January 2010 13:14, Jay Foad <jay.foad at gmail.com> wrote:

> 2010/1/14 Nick Lewycky <nicholas at mxc.ca>:
> > Always make sure to run 'make check' before committing any change. If
> you're
> > paranoid, you can also try out a nightly build before and after, but I
> don't
> > think we care that much :) The nightly test has many failures due to
> things
> > like taking addresses of functions and passing them around (to qsort for
> > example).
>
> OK, it passes "make check".
>
> > Why care about the type? Why not just:
> >
> >  if (isa<UndefValue>(C)) {
> >    GenericValue Result;
> >    Result.IntVal = APInt(C->getType()->getPrimitiveSizeInBits(), 0);
> >    return Result;
> >  }
>
> Because for pointer types this will try to create a 0-bit-wide APInt, and
> fail.
>
> Anyway, I think my version is clearer, because it initialises
> Result.IntVal when and only when it is necessary.
>

Ah, pointers are a "sized type" in the LangRef, but you don't necessarily
know the size without target data. Then your patch sounds good, please
commit it!

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100114/b191154e/attachment.html>


More information about the llvm-commits mailing list