|
From: | Ambroz Bizjak |
Subject: | [avr-libc-dev] [bug #50987] Not all registers need to be declared volatile |
Date: | Tue, 9 May 2017 16:51:41 -0400 (EDT) |
User-agent: | Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 |
Follow-up Comment #2, bug #50987 (project avr-libc): I think it is generally not a good idea to remove volatile from registers because writing/reading registers generally still has a side effect in addition to just changing the value. For example, with volatile register accesses are never reordered (a different order may have different semantics). Another example is that some infinite loops like while(1){REG=1;} would become undefined behavior (at least in C++) without REG being volatile. See: http://en.cppreference.com/w/cpp/language/memory_model (Progress guarantee). In summary I think the only case where removing volatile from a register is where it has no specific hardware semantics at all - reading or writing has no side effect and the value itself does not influence anything. _______________________________________________________ Reply to this item at: <http://savannah.nongnu.org/bugs/?50987> _______________________________________________ Message sent via/by Savannah http://savannah.nongnu.org/
[Prev in Thread] | Current Thread | [Next in Thread] |