Hi,
I'm testing with a simple test case and it seems to fail. Any idea what's going wrong ?
I'm compiling with -O0 and the expected result should be 0x10. It works with >=-O2 as the
for loop will be simplified by LLVM.
Thanks,
Peter
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
uint64_t g_value = 0x10;
int main(int argc, char *argv[]) {
uint64_t x;
if (read(STDIN_FILENO, &x, sizeof(x)) != sizeof(x)) {
printf("Failed to read x\n");
return -1;
}
uint64_t y=0;
for (int i=0;i<x;i++) {
++y;
}
printf("%s\n", (y == g_value) ? "yes" : "no");
return 0;
}