------- Comment #1 from ebotcazou at gcc dot gnu dot org 2007-11-29 07:13 ------- > IMO, there is no need for (1), since we already have correct value in %eax. > However, even when value lives in another register, we should load it into > the return register from the reg, not from mem location.
If 'return z' is deemed an access to the volatile object, we have no other choices that generating the load. In any cases, I'd be extremely cautious about optimizing code manipulating volatile objects. -- ebotcazou at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ebotcazou at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34282