This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/16179] useless copies not optimized away


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]