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 c++/67550] Initialization of local struct array with elements of global array yields zeros instead of initializer values


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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-09-11
                 CC|                            |trippels at gcc dot gnu.org
      Known to work|                            |4.9.3
     Ever confirmed|0                           |1
      Known to fail|                            |5.2.1, 6.0

--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Also happens with a local array:

struct S {
  int x;
  int y;
};
int foo() { return 1; }

int main() {
  S const data[] = {{0, foo()}};

  S data2[] = {data[0]};

  if (!data2[0].y)
    __builtin_abort();
}


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