https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87210
Alexander Potapenko <glider at google dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |glider at google dot com --- Comment #4 from Alexander Potapenko <glider at google dot com> --- To give an update, upstream Clang now supports force initialization of stack variables under the -ftrivial-auto-var-init flag. -ftrivial-auto-var-init=pattern initializes local variables with a 0xAA pattern (actually it's more complicated, see https://reviews.llvm.org/D54604) -ftrivial-auto-var-init=zero provides zero-initialization of locals. This mode isn't officially supported yet and is hidden behind an additional -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang flag. This is done to avoid creating a C++ dialect where all variables are zero-initialized. Starting v5.2, Linux kernel has a CONFIG_INIT_STACK_ALL config that performs the build with -ftrivial-auto-var-init=pattern. This one isn't widely adopted yet, partially because initializing locals with 0xAA isn't fast enough. Linus Torvalds is quite positive about zero-initializing the locals though, see https://lkml.org/lkml/2019/7/30/1303 So having a flag similar to -ftrivial-auto-var-init=zero in GCC will be appreciated by the Linux kernel community.