<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 3, 2015 at 11:03 AM, Lang Hames <span dir="ltr"><<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: lhames<br>
Date: Mon Aug  3 13:03:40 2015<br>
New Revision: 243891<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D243891-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=loB_9Xl921T2ignqsu6HIPXpvfOd35u-oLXSqTifV58&s=do-e9ippFb5V5zRKI0NGFlVqazYfTLEB0LsUEgxT24c&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=243891&view=rev</a><br>
Log:<br>
[MCJIT] Fix a cast warning in the unit-test introduced in r243589.<br>
<br>
Thanks to Aaron Ballman for spotting this.<br>
<br>
Modified:<br>
    llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp<br>
<br>
Modified: llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_unittests_ExecutionEngine_MCJIT_MCJITCAPITest.cpp-3Frev-3D243891-26r1-3D243890-26r2-3D243891-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=loB_9Xl921T2ignqsu6HIPXpvfOd35u-oLXSqTifV58&s=0Nb_NnVg0ynVQ3a6dwlbe55tiq7qOb7Fg9YFVu2J_KM&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp?rev=243891&r1=243890&r2=243891&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp (original)<br>
+++ llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp Mon Aug  3 13:03:40 2015<br>
@@ -514,7 +514,13 @@ TEST_F(MCJITCAPITest, addGlobalMapping)<br>
   buildMCJITOptions();<br>
   buildMCJITEngine();<br>
<br>
-  LLVMAddGlobalMapping(Engine, MappedFn, reinterpret_cast<void*>(&localTestFunc));<br>
+  union {<br>
+    int (*raw)();<br>
+    void *usable;<br>
+  } functionPointer;<br>
+  functionPointer.raw = &localTestFunc;<br></blockquote><div><br>This is actually UB, but I think it's somewhere in the UB subset that LLVM intentionally preserves the expected behavior of (& I'm not sure if we rely on this in other parts of LLVM/assume that all compilers used to build LLVM support this behavior).<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+  LLVMAddGlobalMapping(Engine, MappedFn, functionPointer.usable);<br>
<br>
   buildAndRunPasses();<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>