public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/114285] New: Use of uninitialized value when copying a struct field by field
@ 2024-03-08 13:40 bouanto at zoho dot com
  2024-03-08 14:17 ` [Bug analyzer/114285] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: bouanto at zoho dot com @ 2024-03-08 13:40 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-03-19 13:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-08 13:40 [Bug analyzer/114285] New: Use of uninitialized value when copying a struct field by field bouanto at zoho dot com
2024-03-08 14:17 ` [Bug analyzer/114285] " rguenth at gcc dot gnu.org
2024-03-08 15:07 ` dmalcolm at gcc dot gnu.org
2024-03-08 19:42 ` pinskia at gcc dot gnu.org
2024-03-08 21:28 ` bouanto at zoho dot com
2024-03-08 21:30 ` bouanto at zoho dot com
2024-03-08 21:40 ` pinskia at gcc dot gnu.org
2024-03-11 17:57 ` jakub at gcc dot gnu.org
2024-03-18 20:56 ` bouanto at zoho dot com
2024-03-19 13:13 ` xry111 at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).