yabinc wrote: According to the C23 standard, initializing a union variable with empty braces {} only guarantees the initialization of the first member and any padding after all members. This behavior deviates from common intuition and caused a bug when compiling the Linux kernel. Based on the discussion in https://github.com/llvm/llvm-project/issues/78034, this patch aims to zero-initialize all bytes after the first member. If this change introduces significant regressions in edge cases, a fallback strategy is to replace brace initialization with explicit assignment statements for the specific fields requiring initialization.
https://github.com/llvm/llvm-project/pull/97121 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits