aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-23 10:16:32 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-23 10:16:32 -0800
commit3f8b4e23f754dd65c0b31709ee601388e70fcc89 (patch)
tree20506f52cbad94c9ac153360ac6f7fc77dc6145a /tests
parentb40afadb4f35bb1df98fb8098c6b4edfe17dc6bd (diff)
handle function pointer calls to functions that return function pointers (insert meme here)
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runner.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 842dacad..2be8bff9 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -2860,6 +2860,26 @@ Exiting setjmp function, level: 0, prev_jmp: -1
'''
self.do_run(src, 'fn2(-5) = 5, fn(10) = 3.16')
+ def test_funcptrfunc(self):
+ src = r'''
+ #include <stdio.h>
+
+ typedef void (*funcptr)(int, int);
+ typedef funcptr (*funcptrfunc)(int);
+
+ funcptr __attribute__ ((noinline)) getIt(int x) {
+ return (funcptr)x;
+ }
+
+ int main(int argc, char **argv)
+ {
+ funcptrfunc fpf = argc < 100 ? getIt : NULL;
+ printf("*%p*\n", fpf(argc));
+ return 0;
+ }
+ '''
+ self.do_run(src, '*0x1*')
+
def test_emptyclass(self):
if self.emcc_args is None: return self.skip('requires emcc')
src = '''