[Bug tree-optimization/16179] useless copies not optimized away
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Jun 24 18:43:00 GMT 2004
------- 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
More information about the Gcc-bugs
mailing list