[Bug target/20288] AVR assignment of a value through a 16 bit pointer generates out of order code

bjoern dot m dot haase at web dot de gcc-bugzilla@gcc.gnu.org
Fri Mar 4 19:38:00 GMT 2005


------- Additional Comments From bjoern dot m dot haase at web dot de  2005-03-04 19:38 -------
In reply to comment #10. 
 
I agree with you Jörg, it is not a dramatic loss if you have a bit less 
efficient use of volatile pointers :-) and IMHO anybody in the avr community 
could live with it. I think it's possibly rather a question of style. 
 
I'd like to suggest that the explicit use of a macro while sticking to the 
standard convention for use of the volatile keyword might make it more 
transparent *why* and *that* an explicit treatment is required for 16 bit 
registers. Imagine the case of a person who is reading code written by someone 
else. Just seeing the "volatile" keyword would not make the possible danger 
clear. 
 
Maybe the "volatile" solution makes it easier for some programers and I agree 
with anybody that using macros tends to turn the code uglier. Possibly, 
however, there is the danger that one makes "things easier than they are in 
fact": 
 
With either approach, the user will be required to be avare of the possible 
problem and would have to handle the code accordingly. My personal opinion is: 
If there is a pitfall with 16 bit registers, write code that names it by it's 
real name. 
 
Anyway I could also live with a solution that patches the compiler. 
 
Yours, 
 
Björn 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20288



More information about the Gcc-bugs mailing list