[llvm-branch-commits] [llvm-branch] r226378 - Merging r226170:

Daniel Sanders daniel.sanders at imgtec.com
Sat Jan 17 08:22:27 PST 2015


Author: dsanders
Date: Sat Jan 17 10:22:27 2015
New Revision: 226378

URL: http://llvm.org/viewvc/llvm-project?rev=226378&view=rev
Log:
Merging r226170:
------------------------------------------------------------------------
r226170 | vkalintiris | 2015-01-15 15:36:04 +0000 (Thu, 15 Jan 2015) | 7 lines

Fix the C-API MCJIT test for 32-bit big endian machines.

Avoid using unions for storing the return value from
LLVMGetGlobalValueAddress() and LLVMGetFunctionAddress() and accessing it as
a pointer through another pointer member. This causes problems on 32-bit big
endian machines since the pointer gets the higher part of the return value of
the aforementioned functions.
------------------------------------------------------------------------

Modified:
    llvm/branches/release_36/   (props changed)
    llvm/branches/release_36/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp

Propchange: llvm/branches/release_36/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jan 17 10:22:27 2015
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,226023,226029,226044,226046,226048,226058,226075,226182
+/llvm/trunk:155241,226023,226029,226044,226046,226048,226058,226075,226170,226182

Modified: llvm/branches/release_36/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp?rev=226378&r1=226377&r2=226378&view=diff
==============================================================================
--- llvm/branches/release_36/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp (original)
+++ llvm/branches/release_36/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp Sat Jan 17 10:22:27 2015
@@ -359,13 +359,10 @@ TEST_F(MCJITCAPITest, gva) {
   buildMCJITEngine();
   buildAndRunPasses();
 
-  union {
-    uint64_t raw;
-    int32_t *usable;
-  } valuePointer;
-  valuePointer.raw = LLVMGetGlobalValueAddress(Engine, "simple_value");
+  uint64_t raw = LLVMGetGlobalValueAddress(Engine, "simple_value");
+  int32_t *usable  = (int32_t *) raw;
 
-  EXPECT_EQ(42, *valuePointer.usable);
+  EXPECT_EQ(42, *usable);
 }
 
 TEST_F(MCJITCAPITest, gfa) {
@@ -376,13 +373,10 @@ TEST_F(MCJITCAPITest, gfa) {
   buildMCJITEngine();
   buildAndRunPasses();
 
-  union {
-    uint64_t raw;
-    int (*usable)();
-  } functionPointer;
-  functionPointer.raw = LLVMGetFunctionAddress(Engine, "simple_function");
+  uint64_t raw = LLVMGetFunctionAddress(Engine, "simple_function");
+  int (*usable)() = (int (*)()) raw;
 
-  EXPECT_EQ(42, functionPointer.usable());
+  EXPECT_EQ(42, usable());
 }
 
 TEST_F(MCJITCAPITest, custom_memory_manager) {





More information about the llvm-branch-commits mailing list