Closed
Description
Considering the following code:
#include <stdlib.h>
#include <string.h>
char a[100];
typedef struct {
char *raw;
} data_t;
void init_data(data_t *data, char *raw) {
data->raw = raw;
}
int main() {
strcpy(a, "DATA");
data_t *data = malloc(sizeof(data_t));
init_data(data, a);
char *raw = data->raw;
printf("%c\n", a[0]);
printf("%c\n", raw[0]);
printf("%c\n", data->raw[0]);
free(data);
return 0;
}
Using gcc to compile the program and run it, it would output:
D
D
D
But using shecc, it would output:
D
D
�
This happens because of the incorrect deference assembly code.