RE: volatile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> More specifically, it is a _requirement_ to the compiler that it
always
> reload the variable from memory on access and that it not alias the
> variable in a register, because of the assumption that the variable is
> capable of changing out from under it.

Is there a corresponding action on the writer's side?  If you write to a
volatile variable, what causes the compiler to flush the register to
memory?  Or similarly, what prevents the compiler from removing the
write during optimization if it sees that you never read the variable.

Bruce

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux