================
@@ -361,6 +368,13 @@ CodeGenFunction::AddInitializerToStaticVarDecl(const 
VarDecl &D,
     }
     return GV;
   }
+  if (!getLangOpts().CPlusPlus) {
+    // In C, when an initializer is given, the Linux kernel relies on clang to
+    // zero-initialize all members not explicitly initialized, including 
padding
+    // bits.
----------------
yabinc wrote:

> I don't mind staging it in over multiple commits in principle. If you'd like 
> to switch to an implementation that adds explicit padding fields when 
> building the original constant, you could still stage that and only add those 
> fields in certain language modes.

Changed as suggested, adding explicit padding fields when building the original 
constant.

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

Reply via email to