diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/15-reloc.c | 29 | ||||
| -rw-r--r-- | test/reloc.c | 9 | ||||
| -rwxr-xr-x | test/run.sh | 2 |
3 files changed, 30 insertions, 10 deletions
diff --git a/test/15-reloc.c b/test/15-reloc.c new file mode 100644 index 0000000..8d1b323 --- /dev/null +++ b/test/15-reloc.c @@ -0,0 +1,29 @@ +/* EXPECT: +1.3 +5 +ok +*/ + +const void *const relro = &relro; +float get_value(unsigned x) { + static const float values [] = {1.1f, 1.2f, 1.3f, 1.4f}; + return x < 4 ? values[x] : 0.0f; +} + +static const short tb[] = { 1,3,34,5,23,2,5,5,-7 }; +static const short *ptb = &tb[4]; + +static int ou(int k) { return ptb[k]; } + +int (*(getputs(void)))(const char *) { + extern int puts(const char *); + int (*t)(const char *) = puts; + return t; +} + +#include <stdio.h> +int main() { + printf("%g\n", get_value(2)); + printf("%d\n", ou(2)); + getputs()("ok"); +} diff --git a/test/reloc.c b/test/reloc.c deleted file mode 100644 index ccc03ec..0000000 --- a/test/reloc.c +++ /dev/null @@ -1,9 +0,0 @@ - - -const void *const relro = &relro; - -float get_value(unsigned x) -{ - static const float values [] = {1.1f, 1.2f, 1.3f, 1.4f}; - return x < 4 ? values[x] : 0.0f; -} diff --git a/test/run.sh b/test/run.sh index 34d8101..8954ea7 100755 --- a/test/run.sh +++ b/test/run.sh @@ -1,7 +1,7 @@ #!/bin/env sh cd $(dirname "$0") -ANTCC=../antcc +ANTCC="../antcc $CFLAGS" ntest=0 npass=0 |