diff options
author | Shantonu Sen <ssen@apple.com> | 2009-10-28 15:54:04 +0000 |
---|---|---|
committer | Shantonu Sen <ssen@apple.com> | 2009-10-28 15:54:04 +0000 |
commit | a07fa29cead05031869b7488f4e845584e57b628 (patch) | |
tree | 0df14656a4747007b7edc7169088b7a622eb3ed0 /test | |
parent | 8973a27a086ecf87536cf16c94c787fe92801a6c (diff) | |
download | compiler-rt-a07fa29cead05031869b7488f4e845584e57b628.tar.gz compiler-rt-a07fa29cead05031869b7488f4e845584e57b628.tar.bz2 compiler-rt-a07fa29cead05031869b7488f4e845584e57b628.tar.xz |
Work around strictness in gcc 4.4.1 casting a function pointer to void *
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@85397 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Unit/clear_cache_test.c | 8 | ||||
-rw-r--r-- | test/Unit/enable_execute_stack_test.c | 14 |
2 files changed, 11 insertions, 11 deletions
diff --git a/test/Unit/clear_cache_test.c b/test/Unit/clear_cache_test.c index b9b17351..63ca66e8 100644 --- a/test/Unit/clear_cache_test.c +++ b/test/Unit/clear_cache_test.c @@ -42,16 +42,16 @@ int main() return 1; // verify you can copy and execute a function - memcpy(execution_buffer, &func1, 128); + memcpy(execution_buffer, (void *)(uintptr_t)&func1, 128); __clear_cache(execution_buffer, &execution_buffer[128]); - pfunc f1 = (pfunc)execution_buffer; + pfunc f1 = (pfunc)(uintptr_t)execution_buffer; if ( (*f1)() != 1 ) return 1; // verify you can overwrite a function with another - memcpy(execution_buffer, &func2, 128); + memcpy(execution_buffer, (void *)(uintptr_t)&func2, 128); __clear_cache(execution_buffer, &execution_buffer[128]); - pfunc f2 = (pfunc)execution_buffer; + pfunc f2 = (pfunc)(uintptr_t)execution_buffer; if ( (*f2)() != 2 ) return 1; diff --git a/test/Unit/enable_execute_stack_test.c b/test/Unit/enable_execute_stack_test.c index 2e0a6c22..a0e97bb7 100644 --- a/test/Unit/enable_execute_stack_test.c +++ b/test/Unit/enable_execute_stack_test.c @@ -35,21 +35,21 @@ int func2() int main() { - unsigned char execution_buffer[128]; - // mark stack page containing execution_buffer to be executable - __enable_execute_stack(execution_buffer); + unsigned char execution_buffer[128]; + // mark stack page containing execution_buffer to be executable + __enable_execute_stack(execution_buffer); // verify you can copy and execute a function - memcpy(execution_buffer, &func1, 128); + memcpy(execution_buffer, (void *)(uintptr_t)&func1, 128); __clear_cache(execution_buffer, &execution_buffer[128]); - pfunc f1 = (pfunc)execution_buffer; + pfunc f1 = (pfunc)(uintptr_t)execution_buffer; if ( (*f1)() != 1 ) return 1; // verify you can overwrite a function with another - memcpy(execution_buffer, &func2, 128); + memcpy(execution_buffer, (void *)(uintptr_t)&func2, 128); __clear_cache(execution_buffer, &execution_buffer[128]); - pfunc f2 = (pfunc)execution_buffer; + pfunc f2 = (pfunc)(uintptr_t)execution_buffer; if ( (*f2)() != 2 ) return 1; |