Am 12.01.22 um 12:58 schrieb Han-Wen Nienhuys: > On Fri, Dec 24, 2021 at 5:16 AM Junio C Hamano <gitster@xxxxxxxxx> wrote: >> Once you >> initialize at the declaration with "less meaningful" value (like >> zero initialization), the tools won't be able to tell when the code >> uses that variable "uninitialized" (because the assignment was >> skipped by a bug), since it appears to always be initialied to them. > > Which tools are these? When I add > > static void test_memcpy(void) > { > uint32_t dest; > char not_init[200]; > int i; > memcpy(&dest, not_init, sizeof(dest)); > > for (i = 0 ; i < 10; i++) > not_init[i] = rand() % 255 + 1; > printf("%d", (int) strlen(not_init)); > } > > to the C code, it compiles cleanly if I do "make DEVELOPER=1". https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html says about -Wuninitialized: "Note that there may be no warning about a variable that is used only to compute a value that itself is never used, because such computations may be deleted by data flow analysis before the warnings are printed." And indeed, dest is not used above. But even if we change the funtion to use dest by returning it, GCC versions 9.1 and higher don't warn about the use of the uninitialized buffer. GCC 4.7.1 to 8.5 do warn, though: https://godbolt.org/z/zYz9KvPdK René