[Bug c++/98158] [10/11 Regression] Gcc generates warning about its own generated move assignment operator since r10-3657-gdaa94de24b9afdf2

2020-12-06 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98158

Martin Sebor  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
   Keywords||diagnostic
 Resolution|--- |DUPLICATE

--- Comment #2 from Martin Sebor  ---
The warning works as designed.  It's based on the GIMPLE below
(-fdump-tree-strlen) where GCC synthesizes a single store to clear the two
consecutive members.  There's code in the warning that tries to deal with this
but a better solution would be to emit IL that c orresponds to valid code
instead of IL that's indistinguishable from a buffer overflow.  I.e., instead
of writing the 32 bytes into b write them into (char*) + offsetof (test,
b).

pr96963 already tracks the same problem so I'm going to resolve this as its
duplicate.

   [local count: 1073741824]:
  # prephitmp_60 = PHI <[(struct basic_string
*)].D.24959._M_local_buf(2), pretmp_59(3)>
  MEM[(struct basic_string *)]._M_string_length = 0;
  MEM[(char_type &)prephitmp_60] = 0;
  _37 = _3(D)->b;   <<< address of b
  vect__39.58_74 = MEM  [(char *
{ref-all}) + 32B];
  _39 = MEM <__int128 unsigned> [(char * {ref-all}) + 32B];
  _46 = _3(D)->c;
  _41 = MEM <__int128 unsigned> [(char * {ref-all}) + 48B];
  MEM  [(char * {ref-all})_37] = vect__39.58_74;  
<<< warning: writing 2 __int128's into b with size 16
  _13 = MEM[(const struct basic_string *)]._M_dataplus._M_p;
  if ([(const struct basic_string *)].D.24959._M_local_buf != _13)
goto ; [53.47%]
  else
goto ; [46.53%]

*** This bug has been marked as a duplicate of bug 96963 ***

[Bug c++/98158] [10/11 Regression] Gcc generates warning about its own generated move assignment operator since r10-3657-gdaa94de24b9afdf2

2020-12-06 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98158

Martin Liška  changed:

   What|Removed |Added

   Last reconfirmed||2020-12-06
  Known to work||9.3.0
 Ever confirmed|0   |1
 CC||marxin at gcc dot gnu.org,
   ||msebor at gcc dot gnu.org
Summary|Gcc generates warning about |[10/11 Regression] Gcc
   |its own generated move  |generates warning about its
   |assignment operator |own generated move
   ||assignment operator since
   ||r10-3657-gdaa94de24b9afdf2
 Status|UNCONFIRMED |NEW
  Known to fail||10.2.0, 11.0

--- Comment #1 from Martin Liška  ---
Confirmed, started with r10-3657-gdaa94de24b9afdf2.