[PATCH] Verify that personality functions are actually functions

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 29 08:56:22 PDT 2015


Knowing nothing about any of this stuff, I do find this a bit surprising -
usually values are opaque to their consumers: they're just a value.

(especially with pointer bitcasts (which will go away, eventually) - if I
have a global variable I've put some executable bytes in and I cast a
pointer to that global variable to a pointer to a function, I would expect
that should be interchangeable...)

On Fri, Aug 28, 2015 at 5:33 PM, Pete Cooper via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Hi Philip
>
> While reducing a test case with personality functions, I crashed selection
> DAG.  The reason being that my personality function was no longer a
> function.  The relevant code is
>
>   MF->getMMI().addPersonality(MBB, cast<Function>(LPadInst->getParent()
>                                                       ->getParent()
>                                                       ->getPersonalityFn()
>
>   ->stripPointerCasts()));
>
> We get different behavior in this code, which is able to handle
> non-function personality functions.
>
> EHPersonality llvm::classifyEHPersonality(const Value *Pers) {
>   const Function *F = dyn_cast<Function>(Pers->stripPointerCasts());
>   if (!F)
>     return EHPersonality::Unknown;
>
> And finally, LangRef itself implies that its a function as it says that we
> should 'specify what function to use for exception handling’.
>
> So i’m not sure exactly what behavior we want.
>
> However, assuming we do want personality functions to always actually be
> functions (which was what i originally thought we wanted), here’s a patch
> which teaches the verifier this.
>
> Comments welcome, including the possibility that this is completely wrong
> and that we do want to support other values as personalities.
>
> Cheers
> Pete
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150829/e191a049/attachment.html>


More information about the llvm-commits mailing list