diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2009-10-06 19:06:16 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2009-10-06 19:06:16 +0000 |
commit | 531ccba54ef02f67ca8a9d586fd3cc111f1e8723 (patch) | |
tree | 21296e8da8254f4ec392b19ba49af42f92af2bb6 /llvm/unittests/ExecutionEngine/JIT/JITTest.cpp | |
parent | 4598eb6214ae4b0278ddab17f20caf75542b37a3 (diff) | |
download | bcm5719-llvm-531ccba54ef02f67ca8a9d586fd3cc111f1e8723.tar.gz bcm5719-llvm-531ccba54ef02f67ca8a9d586fd3cc111f1e8723.zip |
Fix illegal cross-type aliasing. Found by baldrick on a newer gcc.
llvm-svn: 83401
Diffstat (limited to 'llvm/unittests/ExecutionEngine/JIT/JITTest.cpp')
-rw-r--r-- | llvm/unittests/ExecutionEngine/JIT/JITTest.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp b/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp index ee27dee39be..a4812bc1762 100644 --- a/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp +++ b/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp @@ -99,9 +99,8 @@ TEST(JIT, GlobalInFunction) { // Get the pointer to the native code to force it to JIT the function and // allocate space for the global. - void (*F1Ptr)(); - // Hack to avoid ISO C++ warning about casting function pointers. - *(void**)(void*)&F1Ptr = JIT->getPointerToFunction(F1); + void (*F1Ptr)() = + reinterpret_cast<void(*)()>((intptr_t)JIT->getPointerToFunction(F1)); // Since F1 was codegen'd, a pointer to G should be available. int32_t *GPtr = (int32_t*)JIT->getPointerToGlobalIfAvailable(G); @@ -115,9 +114,8 @@ TEST(JIT, GlobalInFunction) { // Make a second function identical to the first, referring to the same // global. Function *F2 = makeReturnGlobal("F2", G, M); - // Hack to avoid ISO C++ warning about casting function pointers. - void (*F2Ptr)(); - *(void**)(void*)&F2Ptr = JIT->getPointerToFunction(F2); + void (*F2Ptr)() = + reinterpret_cast<void(*)()>((intptr_t)JIT->getPointerToFunction(F2)); // F2() should increment G. F2Ptr(); |