[Bug tree-optimization/110743] Unexpected -ftrivial-auto-var-init=pattern behavior with partial bitfields
arnd at linaro dot org
gcc-bugzilla@gcc.gnu.org
Fri Jun 19 08:01:31 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110743
--- Comment #5 from Arnd Bergmann <arnd at linaro dot org> ---
I came across another warning of this type in the Linux kernel with gcc-16.1,
reduced a test case to
https://godbolt.org/z/K8974sEq9
void security_add_hooks(void *);
struct layer_mask {
int access : 7;
};
struct layer_masks {
struct layer_mask layers[5];
};
void hook_unix_find(void)
{
struct layer_masks layer_masks;
security_add_hooks(&layer_masks);
}
In kernel builds, this only happens with gcc-16 and not with earlier versions,
but the reduced test case still happens with gcc-12, which introduced
-ftrivial-auto-var-init=pattern
More information about the Gcc-bugs
mailing list