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] [5/6 regression] 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

--- Comment #5 from Jason Wyatt <jwyatt at feralinteractive dot com> ---
When parsing the initialisation of const TestStruct var:
  store_init_value ends up calling split_nonconstant_init, so that only the
constant part of the initialisation of var is stored in DECL_INITIAL(t).

Then when parsing the initialisation of the array, maybe_constant_init
eventually calls through to decl_constant_value(t), i.e. constant_value_1(t,
false, true). That then uses DECL_INITIAL(t) as if it were the whole
initialisation, rather than just the constant part, hence all the non constant
parts aren't initialised correctly.

I've got no idea how this is supposed to work though, presumably at some point
in the chain of calls it's supposed to realise this is not a constant?

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