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 libstdc++/29286] [4.0/4.1/4.2/4.3 Regression] placement new does not change the dynamic type as it should



------- Comment #81 from rguenth at gcc dot gnu dot org  2007-05-18 09:45 -------
Yes, both testcases are valid and are using placement new.  Note the loop
is only to confuse the optimizers enough to re-order the stores and produce
a miscompilation.  Note the loop runs exactly once, and in essence we are doing

  int *p = XXX; /* integer memory */
  *p = 0;
  long *q = new (p) long;
  *q = -1;

and the compiler is re-ordering the stores which is wrong.  *p and *q need to
alias because of the placement new.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29286


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