This fixes CVE-2019-15847 ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91481 ).
For following case:
#include <stdio.h> #include <stdint.h> int main() { uint64_t darn[32]; for(size_t i = 0; i != 32; ++i) darn[i] = __builtin_darn(); for(size_t i = 0; i != 32; ++i) printf("%016lX\n", darn[i]); return 0; }
32 outputs are the same, however they should be different.
Could you please commit a follow-up patch with a comment explaining why this flag is set. The instruction doesn't really have side effects in that it modifies some machine state, the flag is presumably needed so the instruction doesn't get optimized out.