compiler people: how likely is it that timing-safe C code is future-proof? as in, how likely is it that future compilers will e.g. take "uint8_t diff = 0; for (size_t i=0; i<len; i++) diff |= a[i]^b[i]; return diff != 0" and put a conditional bailout jump in the loop?
-
-
I think the intuition for this rule is that a "volatile variable" might actually be something like an IO port where reads cause the IO port to sequentially give you input bytes? so reading from it and ignoring the result is for dropping an input byte from the port's buffer?
-
see https://bennthomsen.wordpress.com/arduino/peripherals/serial-communications/ …: USART_Receive() reads serial data by reading `UDR0`, which expands through several macros into a dereference of a volatile MMIO pointer. so the volatile read from an MMIO region mutates state and must therefore not be removed.
- 10 more replies
New conversation -
-
-
I read that as meaning that you're not supposed to optimize out volatile reads, but maybe I misunderstood?
-
and both GCC and clang don't seem to optimize out volatile loads at -O3 even when it's completely obvious that the result is unused
- 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.