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

Aaron Ballman aaron.ballman at gmail.com
Wed Aug 5 14:24:48 PDT 2015


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





More information about the llvm-commits mailing list