diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-06-28 18:24:06 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-06-28 18:24:06 -0700 |
commit | 145c2f66d979cb402558121e5e2aad3ebf1a8a2a (patch) | |
tree | 6d469e44e37aa4ca350edf97081ca27c6906fd24 /tests/runner.py | |
parent | 7e39bae4648875901a911d1c826b7037a6153712 (diff) |
support for blockaddress/indirectbr. fixes issue 34
Diffstat (limited to 'tests/runner.py')
-rw-r--r-- | tests/runner.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index 1ba5a983..d7848769 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -1469,6 +1469,30 @@ if 'benchmark' not in sys.argv: ''' self.do_test(src, '*96,97,98,101,101*') + def test_indirectbr(self): + src = ''' + #include <stdio.h> + int main(void) { + const void *addrs[2] = { &&FOO, &&BAR }; + + // confuse the optimizer so it doesn't hardcode the jump and avoid generating an |indirectbr| instruction + int which = 0; + for (int x = 0; x < 1000; x++) which = (which + x*x) % 7; + which = (which % 2) + 1; + + goto *addrs[which]; + + FOO: + printf("bad\\n"); + return 1; + BAR: + printf("good\\n"); + const void *addr = &&FOO; + goto *addr; + } + ''' + self.do_test(src, 'good\nbad') + def test_pack(self): src = ''' #include <stdio.h> |