This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52231] [missed optimization/diagnostics] address-of-reference
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 13 Feb 2012 18:19:39 +0000
- Subject: [Bug c++/52231] [missed optimization/diagnostics] address-of-reference
- Auto-submitted: auto-generated
- References: <bug-52231-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52231
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-13 18:19:39 UTC ---
(In reply to comment #1)
> References are just like pointers, just &a is really a and a is really *a.
This is wrong in so many ways.
Pointers can be null, pointers can be uninitialized, pointers can be re-seated.
Would you also argue this shouldn't be optimised?
int i=0;
int& r = i;
// ...
if (&i != &r)
unreachable();