diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:29 +0000 |
commit | 631cd5845e8de329d0e227aaa707d7ea228b8f8f (patch) | |
tree | a1b87c8f8cad01cf18f7c5f57a08f102771ed303 /tests/run-make/issue-97463-abi-param-passing/bad.c | |
parent | Adding debian version 1.69.0+dfsg1-1. (diff) | |
download | rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.tar.xz rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.zip |
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make/issue-97463-abi-param-passing/bad.c')
-rw-r--r-- | tests/run-make/issue-97463-abi-param-passing/bad.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/run-make/issue-97463-abi-param-passing/bad.c b/tests/run-make/issue-97463-abi-param-passing/bad.c new file mode 100644 index 000000000..013314ab2 --- /dev/null +++ b/tests/run-make/issue-97463-abi-param-passing/bad.c @@ -0,0 +1,24 @@ +#include <stdlib.h> +#include <stdint.h> +#include <stdio.h> + + +struct bloc { + uint16_t a; + uint16_t b; + uint16_t c; +}; + +uint16_t c_read_value(uint32_t a, uint32_t b, uint32_t c) { + struct bloc *data = malloc(sizeof(struct bloc)); + + data->a = a & 0xFFFF; + data->b = b & 0xFFFF; + data->c = c & 0xFFFF; + + printf("C struct: a = %u, b = %u, c = %u\n", + (unsigned) data->a, (unsigned) data->b, (unsigned) data->c); + printf("C function returns %u\n", (unsigned) data->b); + + return data->b; /* leak data */ +} |