[Bug analyzer/114285] Use of uninitialized value when copying a struct field by field

2024-03-19 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114285 Xi Ruoyao changed: What|Removed |Added CC||xry111 at gcc dot gnu.org --- Comment #9 fr

[Bug analyzer/114285] Use of uninitialized value when copying a struct field by field

2024-03-18 Thread bouanto at zoho dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114285 --- Comment #8 from Antoni --- Created attachment 57726 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57726&action=edit Reproducer using union I tried switching to a union and I still get the same error. A union is used by std::optional

[Bug analyzer/114285] Use of uninitialized value when copying a struct field by field

2024-03-11 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114285 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #7

[Bug analyzer/114285] Use of uninitialized value when copying a struct field by field

2024-03-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114285 --- Comment #6 from Andrew Pinski --- (In reply to Antoni from comment #4) > A load in LLVM returns undef, so it is not UB. The problem is in > rustc_codegen_gcc itself. Right, GCC gimple semantics are different from LLVM semantics. GCC gimple

[Bug analyzer/114285] Use of uninitialized value when copying a struct field by field

2024-03-08 Thread bouanto at zoho dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114285 --- Comment #5 from Antoni --- (In reply to Andrew Pinski from comment #3) > >Rust will sometimes copy uninitialized memory and I'd like to avoid > >disabling this specific warning. > > > Note in C, there are specific rules about copying unit

[Bug analyzer/114285] Use of uninitialized value when copying a struct field by field

2024-03-08 Thread bouanto at zoho dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114285 --- Comment #4 from Antoni --- (In reply to Andrew Pinski from comment #3) > >Rust will sometimes copy uninitialized memory and I'd like to avoid > >disabling this specific warning. > > > Note in C, there are specific rules about copying unit

[Bug analyzer/114285] Use of uninitialized value when copying a struct field by field

2024-03-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114285 --- Comment #3 from Andrew Pinski --- >Rust will sometimes copy uninitialized memory and I'd like to avoid disabling >this specific warning. Note in C, there are specific rules about copying unitialized memory. Most is it is undefined. It is

[Bug analyzer/114285] Use of uninitialized value when copying a struct field by field

2024-03-08 Thread dmalcolm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114285 --- Comment #2 from David Malcolm --- (In reply to Antoni from comment #0) > Created attachment 57655 [details] > Reproducer for the bug [...] > I tried to reproduce in C and I attached the reproducer. Trunk with -fanalyzer: https://godbolt.o

[Bug analyzer/114285] Use of uninitialized value when copying a struct field by field

2024-03-08 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114285 --- Comment #1 from Richard Biener --- Given GCC considers memory to be initialized when you write to it and copying from A to B involves a write to B the uninit info would be lost if A is uninitialized. So IMO it's reasonable to diagnose a cop