[Bug tree-optimization/82870] [6 Regression] Assignment by Designated Initializer Overwrites a Flexible Array Member

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 7 09:18:00 GMT 2017


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |7.2.1
           Keywords|                            |needs-bisection, wrong-code
   Last reconfirmed|                            |2017-11-07
          Component|c                           |tree-optimization
                 CC|                            |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1
            Summary|Assignment by Designated    |[6 Regression] Assignment
                   |Initializer Overwrites a    |by Designated Initializer
                   |Flexible Array Member       |Overwrites a Flexible Array
                   |                            |Member
   Target Milestone|---                         |6.5
      Known to fail|                            |6.4.0, 7.2.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
    *obj = (struct Example){
        .bitmap = {0, 0, 0, 0, 0, 0}
    };

this _probably_ adds a single 0 for the flex array.  The bug seems to be fixed
on the GCC 7 branch, confirmed on the tip of the GCC 6 branch.

GCC 6 DSEs the table[0] assignment in the following:

Example_assignment ()
{
  struct Example * obj;
  struct Example * D.1788;
  struct Example * obj;

  <bb 2>:
  obj_6 = __builtin_malloc (64);
  obj_6->table[0] = 1000;
  *obj_6 = {};
  return obj_6;


Wonder what fixed it / which bug is the dup.


More information about the Gcc-bugs mailing list