This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/16179] useless copies not optimized away
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jun 2004 18:39:40 -0000
- Subject: [Bug tree-optimization/16179] useless copies not optimized away
- References: <20040624175318.16179.rguenth@tat.physik.uni-tuebingen.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-24 18:39 -------
No read 7.1.5.1 P 4 again and then look at the example in P 5. You will see that I can do:
int i = 10;
const int &a = i;
printf("%d\n", a);
i = 5;
printf("%d\n", a);
And still be defined and not have any problems.
What is invalid/ill-formed is:
const int i = 4;
printf("%d\n", i);
i = 5; <-- ill-formed
printf("%d\n", i);
And undefined:
const int i = 10;
int *a = (int*)&i;
printf("%d\n", *a);
*a = 5;
printf("%d\n", *a);
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16179