forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test for incomplete ccall method declaration behavior for 8-bit integ…
…er parameters in clang-compiled code
- Loading branch information
1 parent
52f3db5
commit 8cfb66f
Showing
6 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ | |
*.dll | ||
*.do | ||
*.o | ||
*.dylib | ||
*.dSYM | ||
|
||
*.out | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/ccall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <stdio.h> | ||
|
||
int xs[300] = {0,0,0,1,0}; | ||
|
||
int __attribute((noinline)) testUcharX(unsigned char x) { | ||
return xs[x]; | ||
} | ||
|
||
#define xstr(s) str(s) | ||
#define str(s) #s | ||
volatile int (*fptr)(unsigned char x); | ||
volatile int a; | ||
volatile int b; | ||
|
||
int main() { | ||
printf("all of the following should be 1 except xs[259] = 0"); | ||
a = 3; | ||
b = 259; | ||
fptr = (volatile int (*)(unsigned char x))&testUcharX; | ||
if ((((long)fptr)&((long)1)<<32) == 1) fptr = NULL; | ||
printf("compiled with: '%s'\nxs[3] = %d\nxs[259] = %d\ntestUcharX(3) = %d\ntestUcharX(%d) = %d\nfptr(3) = %d\nfptr(259) = %d\n", | ||
xstr(CC), xs[a], xs[b], testUcharX(a), b, testUcharX(b), fptr(a), fptr(b)); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ccall_test_func(x) = ccall((:testUcharX, :libccall), Int32, (Int8,), x) | ||
@assert ccall_test_func(3) == 1 | ||
@assert ccall_test_func(259) == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ runtests("image") | |
runtests("gzip") | ||
|
||
runtests("perf") | ||
runtests("ccall") |