int x, &y = x;
int main() { y = 42; }
produces
x:
.zero 4
...
y:
.long x
...
movl y, %eax
movl $42, (%eax)
Since a non-arg reference is always (?) constant it would be safe to omit
movl $42, x
--
Summary: Weak optimization on global references
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: felix dot nawothnig at t-online dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18842