[Bug c++/67550] [5/6 regression] Initialization of local struct array with elements of global array yields zeros instead of initializer values

jwyatt at feralinteractive dot com gcc-bugzilla@gcc.gnu.org
Mon Nov 23 11:27:00 GMT 2015


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

--- Comment #4 from Jason Wyatt <jwyatt at feralinteractive dot com> ---
It appears that while parsing the initialiser for the array,
maybe_constant_init switches the var for a constructor. This constructor only
sets the m2 member variable. You can see the result in the gimple it produces:

        testValue = 1;
        var = {};
        var.m2 = 2;
        var.m1 = testValue;
        array = {};
        array[0].m2 = 2;


More information about the Gcc-bugs mailing list