[Bug middle-end/115527] -ftrivial-auto-var-init appears to clobber explicit initializer
qinzhao at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jul 12 17:57:38 GMT 2024
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]$
More information about the Gcc-bugs
mailing list