mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
433da1fc04
They pass fine.
25 lines
536 B
C
25 lines
536 B
C
#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 */
|
|
}
|