https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114285
Bug ID: 114285 Summary: Use of uninitialized value when copying a struct field by field Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: bouanto at zoho dot com Target Milestone: --- Created attachment 57655 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57655&action=edit Reproducer for the bug Hi. Not sure if it's the same case as the other issues related to -Wanalyzer-use-of-uninitialized-value and I wanted to discuss this anyway. In rustc_codegen_gcc, I can get "use of uninitialized value" when using the Option type, which contains a value and whether there's a value or not. I tried to reproduce in C and I attached the reproducer. Not sure what we should do here. Copying the whole struct doesn't trigger any warning (should it?) and using memcpy doesn't fix the warning. Rust will sometimes copy uninitialized memory and I'd like to avoid disabling this specific warning. Should there be a dinstinction between copying uninitialized memory and using it? What are your thoughts on this? Thanks.