https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124084

--- Comment #2 from kugan at gcc dot gnu.org ---
Issue is that we are emitting CLOBER for 

            index[i] = ptr;
            std::memset(ptr, 0, sizeof(T));
            new (ptr) T;


Which optimises away the memset. See simple dump

      i = 0;
      goto <D.6146>;
      <D.6147>:
      this->index[i] = ptr;
      memset (ptr, 0, 1);
      D.6148 = ptr;
      D.6150 = operator new (1, D.6148);
      MEM[(bool *)D.6150] = {CLOBBER(bob)};
      ptr = ptr + 1;
      i = i + 1;
      <D.6146>:
      _2 = this->size;
      if (i < _2) goto <D.6147>; else goto <D.6151>;
      <D.6151>:

IMO we should not emit CLOBER here for placement new of primitive types.

Reply via email to