[PATCH] D11779: Fix UB in MCJIT test cases that relied on union type punning

David Blaikie dblaikie at gmail.com
Wed Aug 5 14:33:15 PDT 2015


Yeah, I'd be OK with that, for sure. (probably add some checks to ensure
the source/dest types are pointers, probably, somehow, maybe)

On Wed, Aug 5, 2015 at 2:24 PM, Aaron Ballman <aaron.ballman at gmail.com>
wrote:

> aaron.ballman added a comment.
>
> Thank you for taking care of this! Generally, LGTM, but I do wonder if it
> might make sense to make something like (totally untested):
>
> template <typename InTy, typename OutTy>
> static inline OutTy safe_cast_fn_ptr(InTy fn) {
>
>   return reinterpret_cast<OutTy>(reinterpret_cast<uintptr_t>(fn));
>
> }
>
> And use it in place of the extra type casting, since there's a fair amount
> of it in this test file?
>
> ~Aaron
>
>
> http://reviews.llvm.org/D11779
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150805/f5e5e36d/attachment.html>


More information about the llvm-commits mailing list