Open xjtuwxg opened 6 years ago
Hi I got this simple test file when debugging the issue 36:
#include <stdio.h> #include <unistd.h> #include <sys/mman.h> #include <sys/stat.h> // struct stat #include <fcntl.h> // O_RDONLY void print_stat(struct stat sbuf) //void print_stat(struct stat *sbuf) { printf(">> stat sbuf.st_mode: 0x%x\n", sbuf.st_mode); //printf("stat sbuf.st_mode: 0x%x\n", sbuf->st_mode); } int main(int argc, char *argv[]) { struct stat sbuf; int fd = open("fstat.c", O_RDONLY, 0); if (fd < 0) { printf("error"); return 1; } fstat(fd, &sbuf); printf("stat sbuf.st_mode: 0x%x\n", sbuf.st_mode); printf("sizeof(struct stat): %lu, %lu\n", sizeof(sbuf), sizeof(struct stat)); print_stat(sbuf); //print_stat(&sbuf); close(fd); return 0; }
For some reason, it has the following results (the value of st_mode is changed):
st_mode
$ ./2_x86-64 stat sbuf.st_mode: 0x81a4 sizeof(struct stat): 128, 128 >> stat sbuf.st_mode: 0x3a297461
popcorn-compiler: from commit 4ffd16e00d70a40b4cdde9507f6eddadffef62b8, patched with the code from issue 36.
Problem description
Hi I got this simple test file when debugging the issue 36:
For some reason, it has the following results (the value of
st_mode
is changed):Environment
popcorn-compiler: from commit 4ffd16e00d70a40b4cdde9507f6eddadffef62b8, patched with the code from issue 36.