[Bug c/82599] Assignments from statically initialized flexible arrays copy too much

2024-03-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82599

Andrew Pinski  changed:

   What|Removed |Added

  Component|middle-end  |c

--- Comment #2 from Andrew Pinski  ---
Both the C and C++ front-end now produce the wrong code.

[Bug c/82599] Assignments from statically initialized flexible arrays copy too much

2017-10-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82599

Richard Biener  changed:

   What|Removed |Added

   Keywords||accepts-invalid, wrong-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-10-18
Version|5.4.0   |7.2.1
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
Confirmed.  I think the issue is that we make the new type created by
constructing the object compatible (or the same) as the second.  Then we get to
invalid GIMPLE
being simply

  second = first;

which ends up using expr_size from the source.  Iff the C FE wants to support
this kind of assignments (not sure if it really should!) then it needs to
tack appropriate WITH_SIZE_EXPRs on the decls.