diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-04-11 08:08:26 +0200 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-04-11 08:08:26 +0200 |
commit | 466767d23cbc816b5787e6768e5f9a98a95abca9 (patch) | |
tree | d08adb311cebc8f5a897c8d8632a7b0060dc06fb | |
parent | 696d150a5ec5387e78b2aae941a77a190af58562 (diff) | |
download | compcert-kvx-466767d23cbc816b5787e6768e5f9a98a95abca9.tar.gz compcert-kvx-466767d23cbc816b5787e6768e5f9a98a95abca9.zip |
fix types for k1 builtins
-rw-r--r-- | mppa_k1c/CBuiltins.ml | 4 | ||||
-rw-r--r-- | test/monniaux/longjmp/example.c | 55 |
2 files changed, 57 insertions, 2 deletions
diff --git a/mppa_k1c/CBuiltins.ml b/mppa_k1c/CBuiltins.ml index 9d0c607d..e5cdcd01 100644 --- a/mppa_k1c/CBuiltins.ml +++ b/mppa_k1c/CBuiltins.ml @@ -39,8 +39,8 @@ let builtins = { "__builtin_k1_syncgroup", (TVoid [], [TInt(IUInt, [])], false); "__builtin_k1_tlbwrite", (TVoid [], [], false); - "__builtin_k1_get", (TInt(IULong, []), [TInt(IUInt, [])], false); - "__builtin_k1_set", (TVoid [], [TInt(IUInt, []); TInt(IULong, [])], false); + "__builtin_k1_get", (TInt(IULongLong, []), [TInt(IInt, [])], false); + "__builtin_k1_set", (TVoid [], [TInt(IInt, []); TInt(IULongLong, [])], false); (* LSU Instructions *) (* No ACWS - __int128 *) diff --git a/test/monniaux/longjmp/example.c b/test/monniaux/longjmp/example.c new file mode 100644 index 00000000..d3debfaf --- /dev/null +++ b/test/monniaux/longjmp/example.c @@ -0,0 +1,55 @@ +#include <stdio.h> +#include <setjmp.h> + +jmp_buf bufferA, bufferB; + +void routineB(); // forward declaration + +void routineA() +{ + int r ; + + printf("(A1)\n"); + + r = setjmp(bufferA); + if (r == 0) routineB(); + + printf("(A2) r=%d\n",r); + + r = setjmp(bufferA); + if (r == 0) longjmp(bufferB, 20001); + + printf("(A3) r=%d\n",r); + + r = setjmp(bufferA); + if (r == 0) longjmp(bufferB, 20002); + + printf("(A4) r=%d\n",r); +} + +void routineB() +{ + int r; + + printf("(B1)\n"); + + r = setjmp(bufferB); + if (r == 0) longjmp(bufferA, 10001); + + printf("(B2) r=%d\n", r); + + r = setjmp(bufferB); + if (r == 0) longjmp(bufferA, 10002); + + printf("(B3) r=%d\n", r); + + r = setjmp(bufferB); + if (r == 0) longjmp(bufferA, 10003); +} + + +int main(int argc, char **argv) +{ + routineA(); + return 0; +} |