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

--- Comment #3 from qinzhao at gcc dot gnu.org ---
I believe that this is a bug in __builtin_clear_padding.

when I change the testing case to:

struct inner {
    double a;
    char b;
    long l;
};

struct outer {
    struct inner in_array[3];
    int bar;
};

int main(void) {
    struct inner si = {1., 0, 0};
    struct outer o = {// in_array
                      {
                          si,
                          {0, 0, 0},
                          {0, 0, 0},
                      },
                      // bar
                      0};
    __builtin_clear_padding (&o);
    if (o.in_array[0].a != 1.) {
        return 1; // fail
    }
    return 0;
}

when compiled with GCC without any option, it has the same issue.
/home/opc/Install/latest-d/bin/gcc t1.c
1
[opc@qinzhao-ol8u3-x86 115527]$

Reply via email to